在 SUSE Linux 上部署 VNC 遠端桌面,透過 YaST 圖形化配置服務、自定義 xstartup 啟動 GNOME、支援 VNC Viewer 與瀏覽器 Java Applet 雙模式連線。
yast)ssh user@suse-host
vncserver
# 首次執行提示設定密碼(8 字元上限)
Password: ********
Verify: ********
Would you like to enter a view-only password (y/n)? n
# 輸出:New 'X' desktop is linux-eyh7:1
:1 為桌面編號,對應 TCP 埠 5901(5900+編號)、HTTP 埠 5801(5800+編號)。
vi ~/.vnc/xstartup
#!/bin/sh
xrdb $HOME/.Xresources
xsetroot -solid grey
# xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
# twm & # 預設簡易視窗管理器,替換為 GNOME
export DISPLAY=:1
exec gnome-session
關鍵點:
twm &export DISPLAY=:1 指定桌面編號exec gnome-session 替換 Shell 進程,避免殭屍進程chmod +x ~/.vnc/xstartup重啟 VNC:vncserver -kill :1 && vncserver
10.60.30.112:1(IP:桌面編號)https://10.60.30.112:5801tigervnc-server、websockify)ssh -L 5901:localhost:5901 user@host,本地連線 localhost:1,流量經 SSH 加密-X509Cert/-X509Key 憑證加密systemctl enable --now vncserver@:1.service(需 /etc/systemd/system/vncserver@.service 模板)~/.vnc/xstartup、密碼、桌面編號