在Debian系统中,要修改Tigervnc的端口,你需要编辑Tigervnc服务器的配置文件
打开终端。
使用文本编辑器打开Tigervnc服务器的配置文件。通常,该文件位于/etc/systemd/system/tigervncserver@.service
。你可以使用nano或其他文本编辑器打开它:
sudo nano /etc/systemd/system/tigervncserver@.service
[Service]
部分下,找到ExecStart
行。它应该类似于:ExecStart=/usr/bin/vncserver -geometry 1280x800 :%i
ExecStart
行之后,添加一个新的环境变量-localhost
,并设置为你想要使用的端口号。例如,如果你想将端口更改为5902
,则添加以下内容:Environment="VNC_SERVER_ARGS=-localhost no"
ExecStart=/usr/bin/vncserver -geometry 1280x800 :%i -localhost no
保存并关闭文件。
重新加载systemd配置以应用更改:
sudo systemctl daemon-reload
:1
,则现在需要使用:2
:sudo systemctl restart tigervncserver@2.service
现在,Tigervnc服务器应该在新的端口上运行。请确保防火墙允许新端口的连接。