So you finally did it! You have a remote Linux server. Welcome to the other side of the world 😆 Please seat tight as we send you a crate of soda, a pack of gum and T-shirts with weird writings. It is written on the ancient scrolls that every living geek must have a combination of these.

Remote Linux-ing is super fun and you get to learn about ssh and all the super CLI stuff. Plus, ssh (especially used with Authentication keys) helps keep you safe. The honeymoon ends when you want to use a GUI. Of course you can’t use ssh for that so you go to another software like VNC which is okay except is not as secure as ssh.

If you are an admin of a busy server, you will bear me witness that attacks come in the thousands of trial times and having weak links is not good for your sleep. So how can you use VNC securely?

Pretty simple really. Just tunnel it through an ssh connection.

It’s actually a one command thing: $ssh -L <port>:localhost:<port> -N -f -l <user> <IP>

Example: $ssh -L 5900:127.0.0.1:5900 -N -f -l ninjadmin 197.250.30.238

The command above creates a tunnel for VNC to connect through. As you can see, this is an ssh connection so you’re as safe as needs to be.

After you’are done, launch VNC and you will get a prompt.

Enter the IP and port as follows: 127.0.0.1:<port>

E.g: 127.0.0.1:5900

Click connect and you’re good to go!

Note: You have to have allowed the VNC ports in through your firewall if you have any.

About The Author

My name is Patrick. I am a Linux Ninja (DevOps) | Data Analyst | Network Eng | writer. I live the Linux life and dream in R and Scala. I am an aspiring author with my first two books on the way. In my free time, I play WIFI

Related Posts

Leave a Reply

%d bloggers like this: