Virtual Network Computing (VNC) allows you to log into a full desktop on a remote server (as opposed to just opening windows on your local machine, as with X11 over SSH). It can be very useful, and it’s very fast to set up.
Tip of the Trade: VNC makes it easy to log into a full desktop on a remote server. Follow these steps, and your Debian Linux server will be up and running in no time.
I chose to use vnc4 (there are other options, such as TightVNC), so the first step was the vnc4serverDebian/Ubuntu package on my remote server. Once vnc4 is installed, run it for the first time to finish setup, and set a VNC password:
This starts a daemon off, rather than vnc4 running in the foreground. You’ll get your shell prompt back once it’s running.
To kill the server again, use
vncserver -kill :1
You will probably want to edit the ~/.vnc/xstartup file to control which applications and window manager are kicked off at startup. The default window manager is x-window-manager. I prefer Xfce4, which is lightweight and therefore good for running remotely. You can also use Gnome.
To specify, comment out the x-window-managerline and add a line for your preferred session:
Finally, it’s better to run the session through an SSH tunnel (rather than unencrypted on port 5901, as by default). Run this command on the client machine:
ssh -f -N -L 5901:localhost:5901 firstname.lastname@example.org
Then start your server on the remote machine:
Finally, use a VNC client (e.g. xvnc4viewer for Linux, or Chicken of the VNC for Mac) to connect to localhost on port 5901 (the SSH connection is set to forward local port 5901 to remote port 5901), using your VNC password. And you’re in! Just remember to kill the VNC server and your ssh process once you’re done.
Juliet Kemp has been messing around with Linux systems, for financial reward and otherwise, for about a decade. She is also the author of “Linux System Administration Recipes: A Problem-Solution Approach” (Apress, 2009).