Centos - Set up VNC remotely through SSH

If you don't have IPMI access to a server's display, but want to set up and use a GUI you need to set your server up to use vnc through the terminal. VNC (virtual network computing) allows us to view the desktop through a client application. Centos has an application called vino-server installed by default and we will use this for setting up the vnc-server. This is how to do it:

ssh into the remote server

Go to a website and encode a password you will use for connecting to your vnc server
Edit your remote access configuration file:
vi ~/.gconf/desktop/gnome/remote_access/%gconf.xml

Replace the contents with the following: Replace the password with the base64 password you just created from the website
Start the vino server:
export DISPLAY=:0.0
/usr/libexec/vino-server&

Start your vnc client on your local machine (not server) (I am using ubuntu desktop Remmina remote desktop client)

Enter the ip address of your server.
Enable the ssh tunnel.
Enter the vnc password as qwerty
When prompted you will have to enter the ssh password of the server. (for the ssh tunnel)

If this does not work perhaps try stopping iptables or add 5900 to allowed ports.

You should now have a vnc view of the remote server, now go in, change the vnc password to something of your own and restart.

Please note that every time you restart the computer, you will need to restart the vino-server with the commands shown earlier.
References:
How to restart vino via command
Enable remote vnc from the command line

No comments:

Post a Comment