VNC报错:Error: A VNC or X Server is already running as :X [DisplayInUse]

2023-10-30T18:44:02

VNC服务器新建账户后,启动用户进程遇到报错:

Starting VNC server: 32:manzq VNC(R) Server 5.3.3 (r27908) x64 (May 16 2017 12:52:22)
Copyright (C) 2002-2017 RealVNC Ltd.
RealVNC and VNC are trademarks of RealVNC Ltd and are protected by trademark
registrations and/or pending trademark applications in the European Union,
United States of America and other jurisdictions.
Protected by UK patent 2481870; US patent 8760366.
See http://www.realvnc.com for information on VNC.
For third party acknowledgements see:
http://www.realvnc.com/products/vnc/documentation/5.3/acknowledgements.txt

Error: A VNC or X Server is already running as :X [DisplayInUse]

排除VNC服务异常,感觉问题出在端口占用了。于是检查端口监听:

netstat -antp | grep 600x

未显示任何结果。

尝试网上的多个方法,均不能解决,后来偶然发现可以使用lsof命令来检查端口使用情况。

lsof -i tcp:600x
[root@local ~]# lsof -i tcp:6002
COMMAND   PID USER   FD   TYPE    DEVICE SIZE/OFF NODE NAME
sshd    60111  zha    9u  IPv6 182711797      0t0  TCP localhost:6002 (LISTEN)
sshd    60111  zha   10u  IPv4 182711798      0t0  TCP localhost:6002 (LISTEN)

这里可以看到用户zha的ssh进程占用了vnc的6000+x端口,使用kill命令终结掉进程即可。

kill-9 60111

然后再启动用户vnc进程即可。

当前页面是本站的「Baidu MIP」版。发表评论请点击:完整版 »