在具有桥接接口的 Ubuntu Server 20.04 之上运行 Xubuntu 20.04 作为虚拟机。我能够通过 SSH 连接到虚拟机(也可以在 Windows 10 计算机上使用 Putty 来访问虚拟机)。
在 Windows 10 计算机上使用 VNCViewer(TigerVNC 项目的一部分),我输入了虚拟机的 IP 地址。在我输入密码的地方显示密码弹出窗口,但是当我单击“连接”时,我得到了
TigerVNC
An unexpected error occurred when communicating with the server:
Authentication failure: password check failed!
Attempt to reconnect?
[No] [Yes]
我x11vnc
使用通常的方式安装apt
。按照我创建的网上说明
加密的密码文件
sudo x11vnc -storepasswd PASSWORD /home/USER/.vnc/passwd
未加密的密码文件
echo PASSWORD > /home/USER/.vnc/password
我分别执行了
x11vnc -forever -shared -display :0 -rfbauth /home/user/.vnc/passwd
对于加密的和
x11vnc -forever -shared -display :0 -passwdfile /home/xubuntu/.vnc/passwd
对于未加密的密码文件。
笔记:显然我没有同时做这两件事。此外,由于密码的简单性(如“abcd”),密码拼写错误也是不可能的。
两者都在 SSH 终端中生成了以下日志:
x11vnc -forever -shared -display :0 -passwdfile /home/xubuntu/.vnc/passwd
30/03/2022 10:38:02 x11vnc version: 0.9.16 lastmod: 2019-01-05 pid: 6641
30/03/2022 10:38:02 Using X display :0
30/03/2022 10:38:02 rootwin: 0x53b reswin: 0x3800001 dpy: 0xc07a6840
30/03/2022 10:38:02
30/03/2022 10:38:02 ------------------ USEFUL INFORMATION ------------------
30/03/2022 10:38:02 X DAMAGE available on display, using it for polling hints.
30/03/2022 10:38:02 To disable this behavior use: '-noxdamage'
30/03/2022 10:38:02
30/03/2022 10:38:02 Most compositing window managers like 'compiz' or 'beryl'
30/03/2022 10:38:02 cause X DAMAGE to fail, and so you may not see any screen
30/03/2022 10:38:02 updates via VNC. Either disable 'compiz' (recommended) or
30/03/2022 10:38:02 supply the x11vnc '-noxdamage' command line option.
30/03/2022 10:38:02
30/03/2022 10:38:02 Wireframing: -wireframe mode is in effect for window moves.
30/03/2022 10:38:02 If this yields undesired behavior (poor response, painting
30/03/2022 10:38:02 errors, etc) it may be disabled:
30/03/2022 10:38:02 - use '-nowf' to disable wireframing completely.
30/03/2022 10:38:02 - use '-nowcr' to disable the Copy Rectangle after the
30/03/2022 10:38:02 moved window is released in the new position.
30/03/2022 10:38:02 Also see the -help entry for tuning parameters.
30/03/2022 10:38:02 You can press 3 Alt_L's (Left "Alt" key) in a row to
30/03/2022 10:38:02 repaint the screen, also see the -fixscreen option for
30/03/2022 10:38:02 periodic repaints.
30/03/2022 10:38:02
30/03/2022 10:38:02 XFIXES available on display, resetting cursor mode
30/03/2022 10:38:02 to: '-cursor most'.
30/03/2022 10:38:02 to disable this behavior use: '-cursor arrow'
30/03/2022 10:38:02 or '-noxfixes'.
30/03/2022 10:38:02 using XFIXES for cursor drawing.
30/03/2022 10:38:02 GrabServer control via XTEST.
30/03/2022 10:38:02
30/03/2022 10:38:02 Scroll Detection: -scrollcopyrect mode is in effect to
30/03/2022 10:38:02 use RECORD extension to try to detect scrolling windows
30/03/2022 10:38:02 (induced by either user keystroke or mouse input).
30/03/2022 10:38:02 If this yields undesired behavior (poor response, painting
30/03/2022 10:38:02 errors, etc) it may be disabled via: '-noscr'
30/03/2022 10:38:02 Also see the -help entry for tuning parameters.
30/03/2022 10:38:02 You can press 3 Alt_L's (Left "Alt" key) in a row to
30/03/2022 10:38:02 repaint the screen, also see the -fixscreen option for
30/03/2022 10:38:02 periodic repaints.
30/03/2022 10:38:02
30/03/2022 10:38:02 XKEYBOARD: number of keysyms per keycode 7 is greater
30/03/2022 10:38:02 than 4 and 51 keysyms are mapped above 4.
30/03/2022 10:38:02 Automatically switching to -xkb mode.
30/03/2022 10:38:02 If this makes the key mapping worse you can
30/03/2022 10:38:02 disable it with the "-noxkb" option.
30/03/2022 10:38:02 Also, remember "-remap DEAD" for accenting characters.
30/03/2022 10:38:02
30/03/2022 10:38:02 X FBPM extension not supported.
Xlib: extension "DPMS" missing on display ":0".
30/03/2022 10:38:02 X display is not capable of DPMS.
30/03/2022 10:38:02 --------------------------------------------------------
30/03/2022 10:38:02
30/03/2022 10:38:02 Default visual ID: 0x21
30/03/2022 10:38:02 Read initial data from X display into framebuffer.
30/03/2022 10:38:02 initialize_screen: fb_depth/fb_bpp/fb_Bpl 24/32/4096
30/03/2022 10:38:02
30/03/2022 10:38:02 X display :0 is 32bpp depth=24 true color
30/03/2022 10:38:02
30/03/2022 10:38:02 Autoprobing TCP port
30/03/2022 10:38:02 Autoprobing selected TCP port 5901
30/03/2022 10:38:02 Autoprobing TCP6 port
30/03/2022 10:38:02 rfbListenOnTCP6Port: error in bind IPv6 socket: Address already in use
30/03/2022 10:38:02 Autoprobing selected TCP6 port 5901
30/03/2022 10:38:02 listen6: bind: Address already in use
30/03/2022 10:38:02 Not listening on IPv6 interface.
30/03/2022 10:38:02
30/03/2022 10:38:02 Xinerama is present and active (e.g. multi-head).
30/03/2022 10:38:02 Xinerama: number of sub-screens: 1
30/03/2022 10:38:02 Xinerama: no blackouts needed (only one sub-screen)
30/03/2022 10:38:02
30/03/2022 10:38:02 fb read rate: 230 MB/sec
30/03/2022 10:38:02 fast read: reset -wait ms to: 10
30/03/2022 10:38:02 fast read: reset -defer ms to: 10
30/03/2022 10:38:02 The X server says there are 10 mouse buttons.
30/03/2022 10:38:02 screen setup finished.
30/03/2022 10:38:02
The VNC desktop is: SZA-DT043-L-VM0:1
PORT=5901
******************************************************************************
Have you tried the x11vnc '-ncache' VNC client-side pixel caching feature yet?
The scheme stores pixel data offscreen on the VNC viewer side for faster
retrieval. It should work with any VNC viewer. Try it by running:
x11vnc -ncache 10 ...
One can also add -ncache_cr for smooth 'copyrect' window motion.
More info: http://www.karlrunge.com/x11vnc/faq.html#faq-client-caching
我注意到的一件事是,至少在创建未加密的密码文件的情况下运行时x11vnc
会sudo
产生错误
30/03/2022 10:46:06 x11vnc version: 0.9.16 lastmod: 2019-01-05 pid: 6708
No protocol specified
30/03/2022 10:46:06 XOpenDisplay(":0") failed.
30/03/2022 10:46:06 Trying again with XAUTHLOCALHOSTNAME=localhost ...
No protocol specified
30/03/2022 10:46:06 ***************************************
30/03/2022 10:46:06 *** XOpenDisplay failed (:0)
***x11vnc was unable to open the X DISPLAY ":0", it cannot continue
***There may be "Xlib:" error message above with details about the failure
Some tips and guidelines
...
我不知道这如何影响我遇到的问题,但认为它可能会为这里更有知识的人提供一些见解。
由于它是公司内部网络,我并不担心有人闯入我的虚拟机(无论如何,它都是一次性的)。我将尝试在没有任何身份验证的情况下设置 X11VNC(如果可能),但即使这有效,我仍然对当前问题的原因感兴趣。
答案1
这个解决方案是相当荒谬的。我正在使用 TigerVNC 查看器。显然它需要端口 5900(我希望这是默认的 VNC 端口),但我的 x11vnc 始终从 5901 启动。我所要做的就是添加端口。如果其他人偶然发现这种不便,请<REMOTE_MACHINE_IP_ADDR>:<PORT>
在端口不是 5900 的情况下访问您的计算机。