如果连接不是通过 SSH 隧道,我该如何禁止 VNC?
答案1
尽管它没有明确列为选项vnc4server
,但您应该能够将该-localhost
选项传递给底层Xvnc
进程。
从man vncserver
:
You can add Xvnc options at the command line. They will be added to the
invocation of Xvnc without changes.
从man Xvnc
:
-localhost
Only allow connections from the same machine. Useful if you use
SSH and want to stop non-SSH connections from any other hosts.
See the guide to using VNC with SSH on the web site.
或者,您可以使用ufw
或iptables
默认拒绝外部连接,仅打开选定的 SSH 端口。