x11vnc
x11vnc copied to clipboard
-inetd incompatible with pipes
I am connecting to x11vnc -inetd server using stdio. Version 0.9.14 worked with pipes. Version 0.9.16 does not work with pipes, so -inetd does not work with, say, ssh hostname x11vnc -inetd
, unless socat is used to direct stdio to sockets.
The following demonstrates the difference in setup between raw ssh and ssh+socat:
kmarek@kyle-ppc64le /var/home/kmarek
$ cat ~/bin/socktest.sh
#!/bin/sh -x
pstree -shup $$
ls -l /proc/$$/fd
kmarek@kyle-ppc64le /var/home/kmarek
$ ssh kmarek@localhost socktest.sh
+ pstree -shup 678989
systemd(1)---sshd(2481)---sshd(666254)---sshd(666271,kmarek)---socktest.sh(678989)---pstree(679012)
+ ls -l /proc/678989/fd
total 0
lr-x------. 1 kmarek kmarek 64 Nov 20 06:50 0 -> pipe:[8825448]
l-wx------. 1 kmarek kmarek 64 Nov 20 06:50 1 -> pipe:[8825449]
l-wx------. 1 kmarek kmarek 64 Nov 20 06:50 2 -> pipe:[8825450]
lr-x------. 1 kmarek kmarek 64 Nov 20 06:50 255 -> /var/home/kmarek/bin/socktest.sh
kmarek@kyle-ppc64le /var/home/kmarek
$ ssh kmarek@localhost socat - EXEC:socktest.sh,end-close
+ pstree -shup 679145
systemd(1)---sshd(2481)---sshd(666254)---sshd(666271,kmarek)---socat(679122)---socktest.sh(679145)---pstree(679146)
+ ls -l /proc/679145/fd
total 0
lrwx------. 1 kmarek kmarek 64 Nov 20 06:50 0 -> socket:[8763318]
lrwx------. 1 kmarek kmarek 64 Nov 20 06:50 1 -> socket:[8763318]
l-wx------. 1 kmarek kmarek 64 Nov 20 06:50 2 -> pipe:[8798769]
lr-x------. 1 kmarek kmarek 64 Nov 20 06:50 255 -> /var/home/kmarek/bin/socktest.sh
lrwx------. 1 kmarek kmarek 64 Nov 20 06:50 3 -> socket:[8767396]
lrwx------. 1 kmarek kmarek 64 Nov 20 06:50 4 -> socket:[8767397]
Included below is output from x11vnc running over ssh.
x11vnc throwing errors because it assumes stdio is socket pair (never outputs RFB server hello; never receives EOF):
kmarek@kyle-ppc64le /var/home/kmarek
$ ssh kmarek@localhost x11vnc -display :0 -norc -nopw -safer -rfbport 0 -inetd
20/11/2020 06:53:47 -safer mode:
20/11/2020 06:53:47 vnc_connect=0
20/11/2020 06:53:47 accept_remote_cmds=0
20/11/2020 06:53:47 safe_remote_only=1
20/11/2020 06:53:47 launch_gui=0
20/11/2020 06:53:47 x11vnc version: 0.9.16 lastmod: 2019-01-05 pid: 223637
20/11/2020 06:53:47 Using X display :0
20/11/2020 06:53:47 rootwin: 0x79b reswin: 0xee00001 dpy: 0x91970130
20/11/2020 06:53:47
20/11/2020 06:53:47 ------------------ USEFUL INFORMATION ------------------
20/11/2020 06:53:47 X DAMAGE available on display, using it for polling hints.
20/11/2020 06:53:47 To disable this behavior use: '-noxdamage'
20/11/2020 06:53:47
20/11/2020 06:53:47 Most compositing window managers like 'compiz' or 'beryl'
20/11/2020 06:53:47 cause X DAMAGE to fail, and so you may not see any screen
20/11/2020 06:53:47 updates via VNC. Either disable 'compiz' (recommended) or
20/11/2020 06:53:47 supply the x11vnc '-noxdamage' command line option.
20/11/2020 06:53:47
20/11/2020 06:53:47 Wireframing: -wireframe mode is in effect for window moves.
20/11/2020 06:53:47 If this yields undesired behavior (poor response, painting
20/11/2020 06:53:47 errors, etc) it may be disabled:
20/11/2020 06:53:47 - use '-nowf' to disable wireframing completely.
20/11/2020 06:53:47 - use '-nowcr' to disable the Copy Rectangle after the
20/11/2020 06:53:47 moved window is released in the new position.
20/11/2020 06:53:47 Also see the -help entry for tuning parameters.
20/11/2020 06:53:47 You can press 3 Alt_L's (Left "Alt" key) in a row to
20/11/2020 06:53:47 repaint the screen, also see the -fixscreen option for
20/11/2020 06:53:47 periodic repaints.
20/11/2020 06:53:47
20/11/2020 06:53:47 XFIXES available on display, resetting cursor mode
20/11/2020 06:53:47 to: '-cursor most'.
20/11/2020 06:53:47 to disable this behavior use: '-cursor arrow'
20/11/2020 06:53:47 or '-noxfixes'.
20/11/2020 06:53:47 using XFIXES for cursor drawing.
20/11/2020 06:53:47 GrabServer control via XTEST.
20/11/2020 06:53:47
20/11/2020 06:53:47 Scroll Detection: -scrollcopyrect mode is in effect to
20/11/2020 06:53:47 use RECORD extension to try to detect scrolling windows
20/11/2020 06:53:47 (induced by either user keystroke or mouse input).
20/11/2020 06:53:47 If this yields undesired behavior (poor response, painting
20/11/2020 06:53:47 errors, etc) it may be disabled via: '-noscr'
20/11/2020 06:53:47 Also see the -help entry for tuning parameters.
20/11/2020 06:53:47 You can press 3 Alt_L's (Left "Alt" key) in a row to
20/11/2020 06:53:47 repaint the screen, also see the -fixscreen option for
20/11/2020 06:53:47 periodic repaints.
20/11/2020 06:53:47
20/11/2020 06:53:47 XKEYBOARD: number of keysyms per keycode 7 is greater
20/11/2020 06:53:47 than 4 and 51 keysyms are mapped above 4.
20/11/2020 06:53:47 Automatically switching to -xkb mode.
20/11/2020 06:53:47 If this makes the key mapping worse you can
20/11/2020 06:53:47 disable it with the "-noxkb" option.
20/11/2020 06:53:47 Also, remember "-remap DEAD" for accenting characters.
20/11/2020 06:53:47
20/11/2020 06:53:47 X FBPM extension not supported.
20/11/2020 06:53:47 X display is capable of DPMS.
20/11/2020 06:53:47 --------------------------------------------------------
20/11/2020 06:53:47
20/11/2020 06:53:47 Default visual ID: 0x21
20/11/2020 06:53:47 Read initial data from X display into framebuffer.
20/11/2020 06:53:47 initialize_screen: fb_depth/fb_bpp/fb_Bpl 24/32/7680
20/11/2020 06:53:47
20/11/2020 06:53:47 X display :0 is 32bpp depth=24 true color
20/11/2020 06:53:47
20/11/2020 06:53:47 Unable to establish connection with systemd socket
20/11/2020 06:53:47 setsockopt failed: can't set TCP_NODELAY flag, non TCP socket?: Socket operation on non-socket
20/11/2020 06:53:47
20/11/2020 06:53:47 Xinerama is present and active (e.g. multi-head).
20/11/2020 06:53:47 Xinerama: number of sub-screens: 1
20/11/2020 06:53:47 Xinerama: no blackouts needed (only one sub-screen)
20/11/2020 06:53:47
20/11/2020 06:53:47 fb read rate: 1096 MB/sec
20/11/2020 06:53:47 fast read: reset -wait ms to: 10
20/11/2020 06:53:47 fast read: reset -defer ms to: 10
20/11/2020 06:53:47 The X server says there are 10 mouse buttons.
20/11/2020 06:53:47 screen setup finished.
******************************************************************************
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
20/11/2020 06:53:47 rfbNewClient: error in getnameinfo: Socket operation on non-socket
20/11/2020 06:53:47 0 other clients
20/11/2020 06:53:47 setsockopt failed: can't set TCP_NODELAY flag, non TCP socket?: Socket operation on non-socket
20/11/2020 06:53:47 webSocketsHandshake: unknown connection error
20/11/2020 06:53:47 Client gone
20/11/2020 06:53:47 Statistics events Transmit/ RawEquiv ( saved)
20/11/2020 06:53:47 TOTALS : 0 | 0/ 0 ( 0.0%)
20/11/2020 06:53:47 Statistics events Received/ RawEquiv ( saved)
20/11/2020 06:53:47 TOTALS : 0 | 0/ 0 ( 0.0%)
x11vnc cooperating when wrapped with socat (note the RFB server hello):
kmarek@kyle-ppc64le /var/home/kmarek
$ ssh kmarek@localhost "socat - EXEC:'x11vnc -display \:0 -norc -nopw -safer -rfbport 0 -inetd,end-close'"
20/11/2020 06:55:25 -safer mode:
20/11/2020 06:55:25 vnc_connect=0
20/11/2020 06:55:25 accept_remote_cmds=0
20/11/2020 06:55:25 safe_remote_only=1
20/11/2020 06:55:25 launch_gui=0
20/11/2020 06:55:25 x11vnc version: 0.9.16 lastmod: 2019-01-05 pid: 223770
20/11/2020 06:55:25 Using X display :0
20/11/2020 06:55:25 rootwin: 0x79b reswin: 0xee00001 dpy: 0x7a850130
20/11/2020 06:55:25
20/11/2020 06:55:25 ------------------ USEFUL INFORMATION ------------------
20/11/2020 06:55:25 X DAMAGE available on display, using it for polling hints.
20/11/2020 06:55:25 To disable this behavior use: '-noxdamage'
20/11/2020 06:55:25
20/11/2020 06:55:25 Most compositing window managers like 'compiz' or 'beryl'
20/11/2020 06:55:25 cause X DAMAGE to fail, and so you may not see any screen
20/11/2020 06:55:25 updates via VNC. Either disable 'compiz' (recommended) or
20/11/2020 06:55:25 supply the x11vnc '-noxdamage' command line option.
20/11/2020 06:55:25
20/11/2020 06:55:25 Wireframing: -wireframe mode is in effect for window moves.
20/11/2020 06:55:25 If this yields undesired behavior (poor response, painting
20/11/2020 06:55:25 errors, etc) it may be disabled:
20/11/2020 06:55:25 - use '-nowf' to disable wireframing completely.
20/11/2020 06:55:25 - use '-nowcr' to disable the Copy Rectangle after the
20/11/2020 06:55:25 moved window is released in the new position.
20/11/2020 06:55:25 Also see the -help entry for tuning parameters.
20/11/2020 06:55:25 You can press 3 Alt_L's (Left "Alt" key) in a row to
20/11/2020 06:55:25 repaint the screen, also see the -fixscreen option for
20/11/2020 06:55:25 periodic repaints.
20/11/2020 06:55:25
20/11/2020 06:55:25 XFIXES available on display, resetting cursor mode
20/11/2020 06:55:25 to: '-cursor most'.
20/11/2020 06:55:25 to disable this behavior use: '-cursor arrow'
20/11/2020 06:55:25 or '-noxfixes'.
20/11/2020 06:55:25 using XFIXES for cursor drawing.
20/11/2020 06:55:25 GrabServer control via XTEST.
20/11/2020 06:55:25
20/11/2020 06:55:25 Scroll Detection: -scrollcopyrect mode is in effect to
20/11/2020 06:55:25 use RECORD extension to try to detect scrolling windows
20/11/2020 06:55:25 (induced by either user keystroke or mouse input).
20/11/2020 06:55:25 If this yields undesired behavior (poor response, painting
20/11/2020 06:55:25 errors, etc) it may be disabled via: '-noscr'
20/11/2020 06:55:25 Also see the -help entry for tuning parameters.
20/11/2020 06:55:25 You can press 3 Alt_L's (Left "Alt" key) in a row to
20/11/2020 06:55:25 repaint the screen, also see the -fixscreen option for
20/11/2020 06:55:25 periodic repaints.
20/11/2020 06:55:25
20/11/2020 06:55:25 XKEYBOARD: number of keysyms per keycode 7 is greater
20/11/2020 06:55:25 than 4 and 51 keysyms are mapped above 4.
20/11/2020 06:55:25 Automatically switching to -xkb mode.
20/11/2020 06:55:25 If this makes the key mapping worse you can
20/11/2020 06:55:25 disable it with the "-noxkb" option.
20/11/2020 06:55:25 Also, remember "-remap DEAD" for accenting characters.
20/11/2020 06:55:25
20/11/2020 06:55:25 X FBPM extension not supported.
20/11/2020 06:55:25 X display is capable of DPMS.
20/11/2020 06:55:25 --------------------------------------------------------
20/11/2020 06:55:25
20/11/2020 06:55:25 Default visual ID: 0x21
20/11/2020 06:55:25 Read initial data from X display into framebuffer.
20/11/2020 06:55:25 initialize_screen: fb_depth/fb_bpp/fb_Bpl 24/32/7680
20/11/2020 06:55:25
20/11/2020 06:55:25 X display :0 is 32bpp depth=24 true color
20/11/2020 06:55:25
20/11/2020 06:55:25 Unable to establish connection with systemd socket
20/11/2020 06:55:25 setsockopt failed: can't set TCP_NODELAY flag, non TCP socket?: Operation not supported
20/11/2020 06:55:25
20/11/2020 06:55:25 Xinerama is present and active (e.g. multi-head).
20/11/2020 06:55:25 Xinerama: number of sub-screens: 1
20/11/2020 06:55:25 Xinerama: no blackouts needed (only one sub-screen)
20/11/2020 06:55:25
20/11/2020 06:55:25 fb read rate: 1370 MB/sec
20/11/2020 06:55:25 fast read: reset -wait ms to: 10
20/11/2020 06:55:25 fast read: reset -defer ms to: 10
20/11/2020 06:55:25 The X server says there are 10 mouse buttons.
20/11/2020 06:55:25 screen setup finished.
******************************************************************************
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
20/11/2020 06:55:25 0 other clients
20/11/2020 06:55:25 setsockopt failed: can't set TCP_NODELAY flag, non TCP socket?: Operation not supported
20/11/2020 06:55:25 Normal socket connection
RFB 003.008
20/11/2020 06:55:25 Disabled X server key autorepeat.
20/11/2020 06:55:25 to force back on run: 'xset r on' (3 times)
20/11/2020 06:55:25 incr accepted_client=1 for localhost:0 sock=10
20/11/2020 06:55:25 created xdamage object: 0xee00040
20/11/2020 06:55:25 copy_tiles: allocating first_line at size 61
I liked using ssvncviewer exec='ssh target-hostname x11vnc -inetd -display :0'
to securely start a VNC session with no need for explicit redirections. With 0.9.13 (Debian Buster) it worked very well, with 0.9.16 (Debian Bullseye) it no longer works. The workaround is to do ssvncviewer exec='ssh target-hostname socat - \"EXEC:x11vnc -inetd -display \\\:0,end-close\"'
(under assumption that socat
is installed on the target server).