要解決Debian上TigerVNC的兼容性問題,可以參考以下步驟:
sudo apt update
sudo apt install tigervnc-standalone-server tigervnc-common
vncserver -geometry 1920x1080 -localhost no :1
這里的:1
表示VNC服務器將在顯示編號為1的屏幕上運行,監聽端口為5901(5900 + 1)。
~/.vnc/xstartup
文件以啟動桌面環境(例如Xfce):vim ~/.vnc/xstartup
確保文件內容如下:
#!/bin/sh
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
chmod +x ~/.vnc/xstartup
vncserver :1
vncpasswd
vncpasswd
命令可以正常使用,以管理多個遠程連接的密碼。為了提高安全性,可以使用SSH隧道連接到VNC服務器:
ssh -L 5901:localhost:5901 user@your_server_ip
然后使用VNC客戶端連接到本地的5901端口。