How to use vnc to connect remote server with GUI desktop

For my case, I need to bypass one intermediate server so that I can connect to the remote server with vnc. For example, there are two servers (s1, s2) except my local PC and I have to login to s1 so that I can login s2 from my local PC. However, now, I need to use vnc to connect to s2 from my local PC.

In s2 side:

$ vncserver :1

In local PC:

$ ssh -L 5901:10.80.1.1:5901 -l username -f -N afsconnect2.njit.edu
$ vncviewer localhost:590x

Note:
1, afsconnect2.njit.edu is s1 server.
2, 10.80.1.1 is s2 server.
3, Remember to change to vnc session number if “:1” has been taken.


Answered by harryxiyou.

Great tips!

I guess the ‘590x’ should be ‘5901’ as the vncserver is created with ‘:1’.

And for the background info, the tip is using the “Local port forwarding” function of SSH tunnels (an intro at http://www.systutorials.com/39648/port-forwarding-using-ssh-tunnel/ ).


Yes, It should be ‘5901’. I have fixed it. Thank you.

Weiwei Jia

Weiwei Jia is a Ph.D. student in the Department of Computer Science at New Jersey Institute of Technology since 2016. His research interests are include storage systems, operating systems and computer systems.

Leave a Reply

Your email address will not be published. Required fields are marked *