RedHawk7.2.x TigerVNCの設定(HTML) 2024.03.12
# rpm -qa|grep tiger
tigervnc-server-1.3.1-3.el7.x86_64
tigervnc-license-1.3.1-3.el7.noarch
tigervnc-icons-1.3.1-3.el7.noarch
tigervnc-server-minimal-1.3.1-3.el7.x86_64
tigervnc-1.3.1-3.el7.x86_64
# useradd -m vncuser1
# useradd -m vncuser2
# fgrep vncuser /etc/passwd
vncuser1:x:1000:1000::/home/vncuser1:/bin/bash
vncuser2:x:1001:1001::/home/vncuser2:/bin/bash
# cp /usr/lib/systemd/system/vncserver@.service /usr/lib/systemd/system/vncserver_1@.service
# vi /usr/lib/systemd/system/vncserver_1@.service
# The vncserver service unit file
#
# Quick HowTo:
# 1. Copy this file to /etc/systemd/system/vncserver@.service
# 2. Edit <USER> and vncserver parameters appropriately
# ("runuser -l <USER> -c /usr/bin/vncserver %i -arg1 -arg2")
# 3. Run `systemctl daemon-reload`
# 4. Run `systemctl enable vncserver@:<display>.service`
#
# DO NOT RUN THIS SERVICE if your local area network is
# untrusted! For a secure way of using VNC, you should
# limit connections to the local host and then tunnel from
# the machine you want to view VNC on (host A) to the machine
# whose VNC output you want to view (host B)
#
# [user@hostA ~]$ ssh -v -C -L 590N:localhost:590M hostB
#
# this will open a connection on port 590N of your hostA to hostB's port 590M
# (in fact, it ssh-connects to hostB and then connects to localhost (on hostB).
# See the ssh man page for details on port forwarding)
#
# You can then point a VNC client on hostA at vncdisplay N of localhost and with
# the help of ssh, you end up seeing what hostB makes available on port 590M
#
# Use "-nolisten tcp" to prevent X connections to your VNC server via TCP.
#
# Use "-localhost" to prevent remote VNC clients connecting except when
# doing so through a secure tunnel. See the "-via" option in the
# `man vncviewer' manual page.
[Unit]
Description=Remote desktop service (VNC)
After=syslog.target network.target
[Service]
Type=forking
# Clean any existing files in /tmp/.X11-unix environment
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
ExecStart=/usr/sbin/runuser -l <USER> -c "/usr/bin/vncserver %i"
PIDFile=/home/<USER>/.vnc/%H%i.pid
ExecStop=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
[Install]
WantedBy=multi-user.target
# The vncserver service unit file
#
# Quick HowTo:
# 1. Copy this file to /etc/systemd/system/vncserver@.service
# 2. Edit <USER> and vncserver parameters appropriately
# ("runuser -l <USER> -c /usr/bin/vncserver %i -arg1 -arg2")
# 3. Run `systemctl daemon-reload`
# 4. Run `systemctl enable vncserver@:<display>.service`
#
# DO NOT RUN THIS SERVICE if your local area network is
# untrusted! For a secure way of using VNC, you should
# limit connections to the local host and then tunnel from
# the machine you want to view VNC on (host A) to the machine
# whose VNC output you want to view (host B)
#
# [user@hostA ~]$ ssh -v -C -L 590N:localhost:590M hostB
#
# this will open a connection on port 590N of your hostA to hostB's port 590M
# (in fact, it ssh-connects to hostB and then connects to localhost (on hostB).
# See the ssh man page for details on port forwarding)
#
# You can then point a VNC client on hostA at vncdisplay N of localhost and with
# the help of ssh, you end up seeing what hostB makes available on port 590M
#
# Use "-nolisten tcp" to prevent X connections to your VNC server via TCP.
#
# Use "-localhost" to prevent remote VNC clients connecting except when
# doing so through a secure tunnel. See the "-via" option in the
# `man vncviewer' manual page.
[Unit]
Description=Remote desktop service (VNC)
After=syslog.target network.target
[Service]
Type=forking
# Clean any existing files in /tmp/.X11-unix environment
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
ExecStart=/usr/sbin/runuser -l vncuser1 -c "/usr/bin/vncserver %i"
PIDFile=/home/vncuser1/.vnc/%H%i.pid
ExecStop=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
[Install]
WantedBy=multi-user.target
# su - vncuser1
最終ログイン: 2024/03/11 (月) 12:43:31 JST日時 pts/1
[vncuser1@redhawk ~]$ vncpasswd
Password:********
Verify:********
[vncuser1@redhawk ~]$ exit
ログアウト
# su - vncuser2
:
# systemctl enable vncserver_1@\:1
Created symlink from /etc/systemd/system/multi-user.target.wants/vncserver_1@:1.service to /usr/lib/systemd/system/vncserver_1@.service.
# systemctl start vncserver_1@\:1
# systemctl status vncserver_1@\:1
● vncserver_1@:1.service - Remote desktop service (VNC)
Loaded: loaded (/usr/lib/systemd/system/vncserver_1@.service; enabled; vendor preset: disabled)
Active: active (running) since 火 2024-03-12 10:28:52 JST; 8s ago
Process: 26818 ExecStart=/usr/sbin/runuser -l vncuser1 -c /usr/bin/vncserver %i (code=exited, status=0/SUCCESS)
Process: 26814 ExecStartPre=/bin/sh -c /usr/bin/vncserver -kill %i > /dev/null 2>&1 || : (code=exited, status=0/SUCCESS)
Main PID: 26861 (Xvnc)
CGroup: /system.slice/system-vncserver_1.slice/vncserver_1@:1.service
‣ 26861 /usr/bin/Xvnc :1 -desktop redhawk:1 (vncuser1) -auth /home/vncuser1/.Xauthority -geometry 1024x768 -rfbwait 30000 -rfbauth /home/vncuser1/.vnc/passwd -rfbport 59...
3月 12 10:28:49 redhawk systemd[1]: Starting Remote desktop service (VNC)...
3月 12 10:28:52 redhawk systemd[1]: Started Remote desktop service (VNC).
# nmap IP_ADDRESS -p 5900-5999
Starting Nmap 6.40 ( http://nmap.org ) at 2024-03-12 10:31 JST
Nmap scan report for 172.18.3.11
Host is up (0.0000070s latency).
Not shown: 99 closed ports
PORT STATE SERVICE
5901/tcp open vnc-1
Nmap done: 1 IP address (1 host up) scanned in 0.06 seconds
# nmap localhost -p 5900-5999
Starting Nmap 6.40 ( http://nmap.org ) at 2024-03-12 10:31 JST
Nmap scan report for localhost (127.0.0.1)
Host is up (0.0000070s latency).
Other addresses for localhost (not scanned): 127.0.0.1
Not shown: 99 closed ports
PORT STATE SERVICE
5901/tcp open vnc-1
Nmap done: 1 IP address (1 host up) scanned in 0.05 seconds
# /usr/sbin/runuser -l vncuser1 -c "vncserver -list"
TigerVNC server sessions:
X DISPLAY # PROCESS ID
:1 26861
# cat /etc/polkit-1/localauthority/50-local.d/45-allow-colord.pkla
[Allow Colord all Users]
Identity=unix-user:*
Action=org.freedesktop.color-manager.create-device;org.freedesktop.color-manager.create-profile;org.freedesktop.color-manager.delete-device;org.freedesktop.color-manager.delete-profile;org.freedesktop.color-manager.modify-device;org.freedesktop.color-manager.modify-profile
ResultAny=no
ResultInactive=no
ResultActive=yes
# cat /etc/polkit-1/localauthority/50-local.d/46-allow-update-repo.pkla
[Allow Package Management all Users]
Identity=unix-user:*
Action=org.freedesktop.packagekit.system-sources-refresh
ResultAny=yes
ResultInactive=yes
ResultActive=yes
# cat /etc/polkit-1/localauthority/30-site.d/20-no-show-proxy-dialog.pkla
[No Show Proxy Dialog]
Identity=unix-user:*
Action=org.freedesktop.packagekit.system-network-proxy-configure
ResultAny=no
ResultInactive=no
ResultActive=no
# systemctl stop pcscd.socket
# systemctl stop pcscd
# systemctl disable pcscd.socket
# systemctl disable pcscd.service
# mkdir /etc/xdg/autostart/SVAE
# mv /etc/xdg/autostart/esc.desktop /etc/xdg/autostart/SVAE
# yum remove seahorse-sharing
:
依存性を解決しました
================================================================================
Package アーキテクチャー
バージョン リポジトリー 容量
================================================================================
削除中:
seahorse-sharing x86_64 3.8.0-3.el7 installed 136 k
トランザクションの要約
================================================================================
削除 1 パッケージ
インストール容量: 136 k
上記の処理を行います。よろしいでしょうか? [y/N]y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
削除中 : seahorse-sharing-3.8.0-3.el7.x86_64 1/1
検証中 : seahorse-sharing-3.8.0-3.el7.x86_64 1/1
削除しました:
seahorse-sharing.x86_64 0:3.8.0-3.el7
完了しました!
# vncviewer -passwd /home/vncuser1/.vnc/passwd --shared localhost:1 &
TigerVNC Viewer 64-bit v1.3.1 (20151120)
Built on Nov 20 2015 at 20:47:44
Copyright (C) 1999-2011 TigerVNC Team and many others (see README.txt)
See http://www.tigervnc.org for information on TigerVNC.
Tue Mar 12 09:16:06 2024
CConn: connected to host localhost port 5901
CConnection: Server supports RFB protocol version 3.8
CConnection: Using RFB protocol version 3.8
PlatformPixelBuffer: Using default colormap and visual, TrueColor, depth 24.
CConn: Using pixel format depth 24 (32bpp) little-endian rgb888
CConn: Using Tight encoding
CConn: Enabling continuous updates
# vncserver :2
New 'redhawk:2 (root)' desktop is redhawk:2
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/redhawk:2.log
# vncserver -list
TigerVNC server sessions:
X DISPLAY # PROCESS ID
:2 29858
# vncviewer -passwd ~/.vnc/passwd --shared localhost:2 &
TigerVNC Viewer 64-bit v1.3.1 (20151120)
Built on Nov 20 2015 at 20:47:44
Copyright (C) 1999-2011 TigerVNC Team and many others (see README.txt)
See http://www.tigervnc.org for information on TigerVNC.
Tue Mar 12 11:07:17 2024
CConn: connected to host localhost port 5902
CConnection: Server supports RFB protocol version 3.8
CConnection: Using RFB protocol version 3.8
PlatformPixelBuffer: Using default colormap and visual, TrueColor, depth 24.
CConn: Using pixel format depth 24 (32bpp) little-endian rgb888
CConn: Using Tight encoding
CConn: Enabling continuous updates
Viewport: Unexpected release of FLTK key code 65293 (0xff0d)
# vncserver -list
TigerVNC server sessions:
X DISPLAY # PROCESS ID
:2 29858
# vncserver -list
TigerVNC server sessions:
X DISPLAY # PROCESS ID
:2 19229
# vncserver -kill :2
Killing Xvnc process ID 19229
Tue Mar 12 12:57:08 2024
CConn: read: 接続が相手からリセットされました (104)
# runuser -l vncuser1 -c "vncserver -list"
TigerVNC server sessions:
X DISPLAY # PROCESS ID
:1 7240
# runuser -l vncuser1 -c "vncserver -kill :1"
Killing Xvnc process ID 7240
# runuser -l vncuser1 -c "vncserver -list"
TigerVNC server sessions:
X DISPLAY # PROCESS ID
#!/bin/sh
# ~/.vnc/xstartup
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
exec /etc/X11/xinit/xinitrc
#!/bin/sh
# ~/.vnc/xstartup
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
# オリジナル
#exec /etc/X11/xinit/xinitrc
#
xsetroot -solid gray20
####################################################
# 以下の記述はかな漢字変換を利用する場合に必要です
####################################################
export LANG=ja_JP.UTF-8
export GDM_LANG=ja_JP.UTF-8
####################################################
# 仮想モードでは、['+space']による、かな漢字変換エンジンへの切り替えが、
# ホスト側のウィンドウマネージャによって、アクセプトされ、仮想モード側に認識されないため、
# 別のキーバイディングに変更します。
####################################################
gsettings set org.freedesktop.ibus.general.hotkey trigger "['+space', 'Zenkaku_Hankaku', 'Alt+Kanji', 'Alt+grave', 'Hangul', 'Alt+Release+Alt_R']"
gsettings set org.freedesktop.ibus.general.hotkey triggers "['space']"
####################################################
# かな漢字変換エンジンを起動します
####################################################
/usr/bin/ibus-daemon -r --xim -d
/usr/libexec/ibus-engine-kkc --ibus &
/usr/libexec/ibus-engine-simple &
####################################################
# mwm ウィンドウマネージャを起動します
####################################################
/usr/bin/gnome-terminal
exec /usr/bin/mwm
# chmod 755 ~/.vnc/xstartup