Accessing a VNC server over SSH

12:24 PM Unknown 0 Comments

Prerequisite: Server should be accessible by SSH

Configure and start VNC server on your server machine. For example, vnc4server could be installed on Ubuntu and similar flavors. (In this post, I am not covering the steps to configure a VNC server)

On the client or on your local machine, we need to create an SSH connection that securely forwards to the localhost connection for VNC. To do this on Linux/OS X, use following command: 

$ ssh -L 5901:127.0.0.1:5901 -N -f -l user server_ip 

If the server is in any local network eg, under some router etc, then setup port forwarding in your router settings for SSH connection (Port 22).
Finally, on the client, install any VNC client (eg, VNC Viewer by RealVNC - available for all platforms), and login to the server as: localhost:5901

When it prompts for password, enter the one you configured for your VNC server.

0 comments :