Re: VNC over SSH and SOCKS

From: SKH (
Date: 02/05/04

Date: Thu, 05 Feb 2004 16:59:07 GMT

        OK, I got it working all right. Here's a summary, in case anybody is
interested not to make the same mistakes I made.

        First, my SSH software has been built with socks support, which I did not
know and, much to my embarrassment, never bother to test. Thus (using the
notation of my original posting) if in A I invoke

        ssh B

then I get a shell in B, just as I do with

        runsocks ssh B

        Now as far as port forwarding is concerned, runsocks seems to interfere
destructively with SSH. Indeed

        runsocks ssh -L x:localhost:y FIP

seems to fail all the time, in the same way, no matter what port numbers x
and y I use. However, invoking

        ssh -L x:localhost:y FIP

does the right thing, at least when x and y are port numbers used in VNC -
in my case, both x and y are 5901.

        Second, after invoking

        ssh -L 5901:localhost:5901 FIP

I was of course getting a shell on B, as expected. I just did not know
that the port forwarding remains active as long as the shell is up. If one
exits the shell immediately, the VNC connection will never succeed.

        Anyway, once all of the above is understood and done properly,

        vncviewer localhost:1

on A does indeed establish a successful connection to the VNC server on A.
Much to my delight, the performance of this SSH connection seems to be
much snappier than the direct one by means of

        vncviewer FIP:1

At the very least, the mouse pointer moves much more smoothly.