VNC through SSH in one command

I have strong and healthy obsession with SSH and clap my hands every time I find another use for it. I have to admit though, that writing the command to create a SSH tunnel is not the greatest thing i know, so was very pleased to learn that vncviewer had an option to send data through a ssh tunnel by it self.

In a former post on my blog TightVNC and SSH tunnels I explain how to setup a vncserver, create tunnels and connect through firewalls not allowing VNC traffic. Connecting to the server amounted to the following:

tjansson@dirac:$ ssh -f -N -L 5901:localhost:5901 foobar.com
tjansson@dirac:$ vncviewer localhost::5901

It turns out that vncviewer has the option to connect through SSH by it self, so the two commands above can be summarized into:

tjansson@dirac:$ vncviewer -via tjansson@foobar.com localhost:1

This was a story much smaller than usual but it was such a great tip I need to let everyone know. 🙂

This entry was posted in Articles, Computer. Bookmark the permalink.

Leave a Reply