TigerVNCViewer:无法连接到套接字:连接被拒绝(10061)

TigerVNCViewer:无法连接到套接字:连接被拒绝(10061)

当我尝试使用 TigerVNCViewer 从 Win10 客户端连接到 Ubuntu 18.04 服务器时,出现错误,提示连接被拒绝。以前这个功能可以正常工作,但在 Ubuntu 服务器上进行软件更新后,它显然停止了工作。

不应有任何防火墙处于活动状态,并且已在服务器上执行 vncserver 和 vncpasswd。下面包括几个诊断命令的输出。

非常感谢任何帮助解决该问题的帮助。

Win10客户端命令:

TigerVNCViwer

unable to connect to socket: Connection refused (10061)

Win10客户端上WSL的命令:

  • 请注意,从 Win10 客户端上的 WSL 和 Cygwin 到 192.168.1.10 的默认 telnet 和 ssh 连接已成功
$ telnet 192.168.1.10 5901

Trying 192.168.1.10...
telnet: Unable to connect to remote host: Connection refused

Ubuntu 服务器上的命令:

$ uname --all

Linux FooHost 5.3.0-28-generic #30~18.04.1-Ubuntu SMP Fri Jan 17 06:14:09 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux


$ ifconfig

enp3s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.10  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::eb13:faea:f55c:e235  prefixlen 64  scopeid 0x20<link>
        ether 10:bf:48:87:25:f6  txqueuelen 1000  (Ethernet)
        RX packets 11209  bytes 10099146 (10.0 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 6759  bytes 2418488 (2.4 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 6678  bytes 382526 (382.5 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 6678  bytes 382526 (382.5 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0


$ vncserver --list

TigerVNC server sessions:

X DISPLAY #     PROCESS ID
:1              3927


$ sudo iptables --list

Chain INPUT (policy ACCEPT)
target     prot opt source               destination

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination


$ sudo ufw status

Status: inactive


$ sudo lsof -P -i

COMMAND    PID            USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
systemd-r  491 systemd-resolve   12u  IPv4   1971      0t0  UDP localhost:53
systemd-r  491 systemd-resolve   13u  IPv4   1972      0t0  TCP localhost:53 (LISTEN)
avahi-dae  847           avahi   12u  IPv4  24646      0t0  UDP *:5353
avahi-dae  847           avahi   13u  IPv6  24647      0t0  UDP *:5353
avahi-dae  847           avahi   14u  IPv4  24648      0t0  UDP *:34033
avahi-dae  847           avahi   15u  IPv6  24649      0t0  UDP *:44878
sshd      1079            root    3u  IPv4  30370      0t0  TCP *:22 (LISTEN)
sshd      1079            root    4u  IPv6  30372      0t0  TCP *:22 (LISTEN)
dhclient  1169            root    6u  IPv4  28935      0t0  UDP *:68
cupsd     2762            root    6u  IPv6  26605      0t0  TCP ip6-localhost:631 (LISTEN)
cupsd     2762            root    7u  IPv4  26606      0t0  TCP localhost:631 (LISTEN)
cups-brow 2763            root    7u  IPv4  33998      0t0  UDP *:631
sshd      2848            root    3u  IPv4  33644      0t0  TCP Cheaptos:22->192.168.1.11:1629 (ESTABLISHED)
sshd      2954           rbohl    3u  IPv4  33644      0t0  TCP Cheaptos:22->192.168.1.11:1629 (ESTABLISHED)
Xtigervnc 3927           rbohl    7u  IPv4  34521      0t0  TCP localhost:5901 (LISTEN)
Xtigervnc 3927           rbohl    8u  IPv6  34522      0t0  TCP ip6-localhost:5901 (LISTEN)
inetd     4397            root    7u  IPv4  39902      0t0  TCP *:23 (LISTEN)

答案1

尝试vncserver从参数开始-localhost no,这对我有用。

vncserver -localhost no

答案2

您需要安装dbus-x11,然后重新启动 Win-KeX 和 vnc-server。

  1. 关闭 VNC 服务器和 Kex:
vncserver --kill :*
kex kill
kex stop
  1. 安装dbus-x11
sudo apt update
sudo apt install dbus-x11
  1. 重新启动 Win-Kex:
kex -s

此 YouTube 视频有更多可能有用的信息。

相关内容