The way I connect to the remote machine is by securely tunneling the port for the VNC session through my SSH connection. The default port that the client tries to connect to is TCP 5900. The VNC server may host many displays. Display :0 is generally for a physical display and made available on port 5900. The virtual displays :1, :2, :3, etc are on ports 5901, 5902, 5903, etc. Documented here, we will only have one virtual display made available on port 5901 on the server. We tunnel it through SSH to local port 5900 like so:
ssh alinuxvm -L 5900:localhost:5901
where `alinuxvm` is the IP address or host name for the server. I can then connect to the computer using the Screen Sharing app:
When I connect, I'm able to access my 1900x1200 display of the Xfce Desktop Environment. I'll explain how to adjust the resolution and set this up below.
I've installed VNC server on both Ubuntu 14.04 desktop and server. There are two primary tutorials I used:
- How to Install and Configure VNC on Ubuntu 14.04
https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-vnc-on-ubuntu-14-04 - How to install VNC Server on Ubuntu 14.04
https://www.namhuy.net/3106/install-vnc-server-ubuntu-14-04.html
I tried both TightVNC and vnc4server and I had better luck with TightVNC. I recommend it. Follow the instructions listed in #1. Step three has you create a /etc/init.d/vncserver file. The only thing I did was modify the geometry and user as documented.
After adjusting the geometry, just restart the vncserver with:
sudo service vncserver restart
You don't need to close the Screen Sharing app before doing so. The only other step I stumbled on was not being able to see what I typed in the Xfce Terminal app. I resolved this by deselecting Use colors from system theme:
Enjoy remote accessing the Linux graphical user interfaces!