LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Unable to use remote x11vnc on a ssh tunnel (https://www.linuxquestions.org/questions/linux-newbie-8/unable-to-use-remote-x11vnc-on-a-ssh-tunnel-4175658464/)

jaro2019 08-02-2019 02:03 AM

Unable to use remote x11vnc on a ssh tunnel
 
I want to connect to my desktop at work via vnc. Here how I did:

On the remote machine I ran:
Code:

autossh -M 8081 -NR  2222:localhost:22 -p3082 censor@censor.sytes.net
On local machine I ran:
Code:

ssh -vvv -NL 5900:localhost:5900 work

define work in .ssh/config
Code:

Host work
    Hostname localhost
    User censor
    Port 2222

And start x11vnc server
Code:

export DISPLAY=:0
x11vnc

When use remmina connect to address localhost:5900 it just flash then disappear.
The log of the x11vnc
Code:

24/07/2019 16:23:40 Got connection from client 127.0.0.1
24/07/2019 16:23:40  other clients:
24/07/2019 16:23:40 Normal socket connection
24/07/2019 16:23:40 Disabled X server key autorepeat.
24/07/2019 16:23:40  to force back on run: 'xset r on' (3 times)
24/07/2019 16:23:40 incr accepted_client=1 for 127.0.0.1:33082  sock=11
24/07/2019 16:23:40 Client Protocol Version 3.8
24/07/2019 16:23:40 Protocol version sent 3.8, using 3.8
24/07/2019 16:23:40 rfbProcessClientSecurityType: executing handler for type 1
24/07/2019 16:23:40 rfbProcessClientSecurityType: returning securityResult for client rfb version >= 3.8
24/07/2019 16:23:41 Pixel format for client 127.0.0.1:
24/07/2019 16:23:41  8 bpp, depth 8
24/07/2019 16:23:41  true colour: max r 7 g 7 b 3, shift r 0 g 3 b 6
24/07/2019 16:23:41 copy_tiles: allocating first_line at size 61
24/07/2019 16:23:41 rfbProcessClientNormalMessage: ignoring unsupported encoding type ultraZip
24/07/2019 16:23:41 Using compression level 9 for client 127.0.0.1
24/07/2019 16:23:41 Using image quality level 0 for client 127.0.0.1
24/07/2019 16:23:41 Using JPEG subsampling 1, Q15 for client 127.0.0.1
24/07/2019 16:23:41 Enabling X-style cursor updates for client 127.0.0.1
24/07/2019 16:23:41 Enabling full-color cursor updates for client 127.0.0.1
24/07/2019 16:23:41 Enabling cursor position updates for client 127.0.0.1
24/07/2019 16:23:41 Enabling KeyboardLedState protocol extension for client 127.0.0.1
24/07/2019 16:23:41 Enabling NewFBSize protocol extension for client 127.0.0.1
24/07/2019 16:23:41 Enabling LastRect protocol extension for client 127.0.0.1
24/07/2019 16:23:41 Enabling SupportedMessages protocol extension for client 127.0.0.1
24/07/2019 16:23:41 Enabling SupportedEncodings protocol extension for client 127.0.0.1
24/07/2019 16:23:41 Enabling ServerIdentity protocol extension for client 127.0.0.1
24/07/2019 16:23:41 Using tight encoding for client 127.0.0.1
24/07/2019 16:23:41 client_count: 0
24/07/2019 16:23:41 Restored X server key autorepeat to: 1
24/07/2019 16:23:41 viewer exited.
24/07/2019 16:23:41 deleted 60 tile_row polling images.

Log of ssh -vvv:
Code:

debug1: Connection to port 5900 forwarding to localhost port 5900 requested.
debug2: fd 9 setting TCP_NODELAY
debug2: fd 9 setting O_NONBLOCK
debug3: fd 9 is O_NONBLOCK
debug1: channel 5: new [direct-tcpip]
debug3: send packet: type 90
debug3: receive packet: type 91
debug2: channel 5: open confirm rwindow 2097152 rmax 32768
debug2: channel 5: window 1992972 sent adjust 104180
debug2: channel 5: read<=0 rfd 9 len -1
debug2: channel 5: read failed
debug2: channel 5: close_read
debug2: channel 5: input open -> drain
debug2: channel 5: ibuf empty
debug2: channel 5: send eof
debug3: send packet: type 96
debug2: channel 5: input drain -> closed
debug3: receive packet: type 96
debug2: channel 5: rcvd eof
debug2: channel 5: output open -> drain
debug2: channel 5: obuf empty
debug2: channel 5: close_write
debug2: channel 5: chan_shutdown_write: shutdown() failed for fd 9: Transport endpoint is not connected
debug2: channel 5: output drain -> closed
debug3: receive packet: type 97
debug2: channel 5: rcvd close
debug3: channel 5: will not send data after close
debug2: channel 5: send close
debug3: send packet: type 97
debug2: channel 5: is dead
debug2: channel 5: garbage collecting
debug1: channel 5: free: direct-tcpip: listening port 5900 for localhost port 5900, connect from 127.0.0.1 port 36686 to 127.0.0.1 port 5900, nchannels 6
debug3: channel 5: status: The following connections are open:
  #2 direct-tcpip: listening port 5900 for localhost port 5900, connect from 127.0.0.1 port 36662 to 127.0.0.1 port 5900 (t4 r0 i0/0 o3/0 fd 6/6 cc -1)
  #3 direct-tcpip: listening port 5900 for localhost port 5900, connect from 127.0.0.1 port 36664 to 127.0.0.1 port 5900 (t4 r1 i0/0 o3/0 fd 7/7 cc -1)
  #4 direct-tcpip: listening port 5900 for localhost port 5900, connect from 127.0.0.1 port 36666 to 127.0.0.1 port 5900 (t4 r2 i0/0 o3/0 fd 8/8 cc -1)
  #5 direct-tcpip: listening port 5900 for localhost port 5900, connect from 127.0.0.1 port 36686 to 127.0.0.1 port 5900 (t4 r3 i3/0 o3/0 fd 9/9 cc -1)

debug1: Connection to port 5900 forwarding to localhost port 5900 requested.
debug2: fd 9 setting TCP_NODELAY
debug2: fd 9 setting O_NONBLOCK
debug3: fd 9 is O_NONBLOCK
debug1: channel 5: new [direct-tcpip]
debug3: send packet: type 90
debug3: receive packet: type 92
channel 5: open failed: connect failed: Connection refused
debug2: channel 5: zombie
debug2: channel 5: garbage collecting
debug1: channel 5: free: direct-tcpip: listening port 5900 for localhost port 5900, connect from 127.0.0.1 port 36688 to 127.0.0.1 port 5900, nchannels 6
debug3: channel 5: status: The following connections are open:
  #2 direct-tcpip: listening port 5900 for localhost port 5900, connect from 127.0.0.1 port 36662 to 127.0.0.1 port 5900 (t4 r0 i0/0 o3/0 fd 6/6 cc -1)
  #3 direct-tcpip: listening port 5900 for localhost port 5900, connect from 127.0.0.1 port 36664 to 127.0.0.1 port 5900 (t4 r1 i0/0 o3/0 fd 7/7 cc -1)
  #4 direct-tcpip: listening port 5900 for localhost port 5900, connect from 127.0.0.1 port 36666 to 127.0.0.1 port 5900 (t4 r2 i0/0 o3/0 fd 8/8 cc -1)

What did I do wrong?

computer_freak_8 08-17-2019 03:12 PM

A few thoughts:

Quote:

Originally Posted by jaro2019 (Post 6020749)
Code:

ssh -vvv -NL 5900:localhost:5900 work

What if you just:
Code:

ssh work
Does it connect as expected? If no, fix that first. If so, keep that window open. Try:
Code:

netstat -tna | grep 5900
Anything? If not, port 5900 isn't listening anyway, this is probably part of the issue.
If it shows open, then go ahead and try a new window your original SSH command with port forwarding 5900. Then, on the local machine, try the same netstat command, to see if it's actually forwarded the port.

If all this seems to be working, you at least know the port forwarding appears to be working.
Code:

nmap -p5900 localhost
should show "open". At that point, it's probably beyond my skills. :-)


All times are GMT -5. The time now is 09:55 PM.