报错如下

在这里插入图片描述

排查&解决

检查监听情况:端口5901处于监听状态,监听IP是127.0.0.1。说明只能使用127.0.0.1进行连接,使用真实IP(非127.0.0.1)进行连接则失败,需要将监听IP修改为0.0.0.0

fivek@fivek-host:~$ vncserver -list

TigerVNC server sessions:

X DISPLAY #	RFB PORT #	PROCESS ID
:1		5901		4573
fivek@fivek-host:~$ netstat -ano | grep 5901
tcp        0      0 127.0.0.1:5901          0.0.0.0:*               LISTEN      off (0.00/0/0)
tcp6       0      0 ::1:5901                :::*                    LISTEN      off (0.00/0/0)
fivek@fivek-host:~$ 

修改监听IP为0.0.0.0,使用 sudo vncserver -localhost no 命令即可将监听IP改为0.0.0.0

fivek@fivek-host:~$ sudo vncserver -localhost no

New 'fivek-host:1 (root)' desktop at :1 on machine fivek-host

Starting applications specified in /etc/X11/Xvnc-session
Log file is /root/.vnc/fivek-host:1.log

Use xtigervncviewer -SecurityTypes VncAuth,TLSVnc -passwd /root/.vnc/passwd fivek-host:1 to connect to the VNC server.

fivek@fivek-host:~$ 
fivek@fivek-host:~$ netstat -ano | grep 5901
tcp        0      0 0.0.0.0:5901            0.0.0.0:*               LISTEN      off (0.00/0/0)
tcp6       0      0 :::5901                 :::*                    LISTEN      off (0.00/0/0)
fivek@fivek-host:~$ 
Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐