vncでは個別にvncサーバを起動させてました。
ここではXDMCPをそのままvncに乗せたいと思います。
参照先:https://www.ibm.com/developerworks/jp/opensource/library/os-multiuserloginsvnc/index.html
https://www.itzgeek.com/how-tos/linux/centos-how-tos/remote-login-with-gdm-and-vnc-on-centos-7-rhel-7-configure-vnc-on-xinetd-with-xdmcp-centos-7-rhel-7.html
まずはXDMCPを有効にします
xdmcpを有効に †
ここではgdmを対象にしてます
[root@rockylinux9 ~]# vi /etc/gdm/custom.conf
# GDM configuration storage
[daemon]
# Uncomment the line below to force the login screen to use Xorg
#WaylandEnable=false
[security]
AllowRemoteRoot=true
DisallowTCP=false
[xdmcp]
Enable=true
[chooser]
[debug]
# Uncomment the line below to turn on debugging
#Enable=true
[root@rockylinux9 ~]#
設定後にgdmを再起動させます。
[root@rockylinux9 ~]# systemctl restart gdm
xinetdの準備 †
次にxinetdを入れてvncを有効にさせます
っが RHEL9 系から xinetd は廃止となりました.
なので xinetd 内のサービスを systemd に移し替えて使うようにします
vnc serverをインストール †
[root@rockylinux9 ~]# dnf install tigervnc-server-minimal
systemdの準備 †
RHEL9系向けに vncserver@xinetd を systemd で賄うようにします
RHEL7/8系なら /etc/xinetd.d/vncserver を下記にしますが、
service vncserver
{
disable = no
socket_type = stream
protocol = tcp
wait = no
user = nobody
server = /usr/bin/Xvnc
server_args = -inetd -once -query localhost -geometry 1024x768 -depth 16 -securitytypes=none
type = UNLISTED
port = 5900
}
これを「/etc/systemd/system/vncserver.socket」「/etc/systemd/system/vncserver@.service」として作って
[root@rockylinux9 ~]# vi /etc/systemd/system/vncserver.socket
[Unit]
Description=VNCserver Socket
[Socket]
ListenStream=5900
Accept=yes
[Install]
WantedBy=sockets.target
[root@rockylinux9 ~]#
[root@rockylinux9 ~]# vi /etc/systemd/system/vncserver@.service
[Unit]
Description=VNCserver Per-Connection Server
[Service]
ExecStart=/usr/bin/Xvnc -inetd -once -query localhost -geometry 1024x768 -depth 16 -securitytypes=none
User=nobody
Group=nobody
StandardInput=socket
[root@rockylinux9 ~]#
作ったsocketを有効にして起動させます
[root@rockylinux9 ~]# systemctl enable vncserver.socket
Created symlink /etc/systemd/system/sockets.target.wants/vncserver.socket → /etc/systemd/system/vncserver.socket.
[root@rockylinux9 ~]#
[root@rockylinux9 ~]# systemctl start vncserver.socket
[root@rockylinux9 ~]# systemctl status vncserver.socket
● vncserver.socket - VNCserver Socket
Loaded: loaded (/etc/systemd/system/vncserver.socket; enabled; vendor preset: disabled)
Active: active (listening) since Thu 2023-04-13 11:29:13 JST; 11s ago
Until: Thu 2023-04-13 11:29:13 JST; 11s ago
Listen: [::]:5900 (Stream)
Accepted: 0; Connected: 0;
Tasks: 0 (limit: 101932)
Memory: 8.0K
CPU: 430us
CGroup: /system.slice/vncserver.socket
Apr 13 11:29:13 rockylinux9 systemd[1]: Listening on VNCserver Socket.
[root@rockylinux9 ~]#
firewall †
5900を使うのでまずは「/usr/lib/firewalld/services/」にサービス登録があるかを調べる
どうやら「/usr/lib/firewalld/services/vnc-server.xml」が 5900-5903/tcp をカバーしているのでこれを適用します
[root@rockylinux9 ~]# firewall-cmd --add-service=vnc-server --zone=public --permanent
[root@rockylinux9 ~]# firewall-cmd --reload
vncビューアでアクセス †
windowsPCでVNC Viewerを使ってます. https://www.realvnc.com/en/connect/download/viewer/
アプリを起動させ、接続先に「rockylinux9」と入力してリターンすると画面が開きます

相手先との通信に暗号化されていないと下記のようなメッセージが表示されます

どうすれば暗号化させた通信になるのかは調べてないです
っで上手く行くと下記のようになる

ただ、、、残念なことに画面解像度は「vncserver@.service」に記載した値の固定となるので、微妙かなぁ...