Using a vnc client through ssh tunnel
Several options are available. First you need to setup a TCP tunnel.
If the port forwarding to the local network is not disabled in the sshd_conf at host 1, then this would be enough:
ssh -t -L 5901:ip-of-host2:5901 user@Host1
Otherwise you need to build a chain of port forwardings:
ssh -L 5901:127.0.0.1:15901 user1@Host1 ssh -L 15901:127.0.0.1:5901 user@host2
if the password authentication is used to connect to host2 then add a -t
option to the first ssh
:
ssh -t -L 5901:127.0.0.1:15901 user1@Host1 ssh -L 15901:127.0.0.1:5901 user@host2
Then use vncviewer
of your choice to connect to the display localhost:1
. I prefer to use TigerVNC.
Related videos on Youtube
Comments
-
ampc over 1 year
Laptop(osx-home network)------>Host1(linux-pc-college network)---->Host2(linux-pc-using vncserver on port 5901, can only be accessed from host1)
I can access host2 through ssh using:
- [user@laptop ~]$ ssh user1@host1
- [user1@host1 ~]$ ssh user2@host2
I need to access host2 vncserver using a ssh tunnel from "laptop". Any recommendation, also, which vnclient is suitable for this task?
-
ampc over 11 yearsThanks @serge that worked. Now I just need to config vncserver. It displays file manager windows like this:i.imgur.com/wns0q.jpg
-
Serge over 11 yearsI don't know why. I have no experience with Mac