在Debian系統中,TightVNC服務器默認使用用戶root
運行
sudo apt-get update
sudo apt-get install tightvncserver
vncusers
,用于管理VNC服務器的用戶權限:sudo groupadd vncusers
vncusers
組:sudo usermod -a -G vncusers <username>
將<username>
替換為實際的用戶名。
編輯TightVNC服務器的配置文件,通常位于/etc/systemd/system/vncserver@:1.service
。使用你喜歡的文本編輯器打開它,例如:
sudo nano /etc/systemd/system/vncserver@:1.service
找到以下行:
User=root
Group=root
將其更改為:
User=<username>
Group=vncusers
將<username>
替換為你在第3步中添加到vncusers
組的用戶名。保存并關閉文件。
sudo systemctl daemon-reload
sudo systemctl restart vncserver@:1.service
現在,VNC服務器應該以新創建的用戶身份運行,該用戶屬于vncusers
組。這樣,你就可以根據需要設置更細粒度的權限。