No Good? You Can Also Lock the Visible GUI!
The SSH method isn’t for everybody, however. Command line access, while still a large part of Linux and Ubuntu, is often discouraged these days as the platform pushes the increasingly improving GUI.
If spending time remotely connected to your Ubuntu PC while locked in command line mode isn’t something that appeals to you, there is an alternative in the shape of VNC, via the vnc4server tool.
Whether you’re connected via SSH or have access to the device in person, the best way of setting this up is via the command line, where you will begin by calling for the server to be downloaded and installed:
sudo apt-get install vnc4server
Once this has been done, a second server connection can be created that will run in the background:
sudo vncserver :1
The next step is to edit the $HOME/.vnc/xstartup file in a text editor so the following is displayed:
# Uncomment the following two lines for normal desktop:
#[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
#[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
#xsetroot -solid grey
#vncconfig -iconic &
#xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
Finally, restart the new VNC server:
sudo vncserver -kill :1
sudo vncserver :1
Any VNC client application should then allow you to access the secondary desktop, but you will need to append the port number appropriately. For instance if you were connecting to an Ubuntu computer on IP 123.456.789.10 and the port was 2700, the port number for desktop :1 that you have just setup would be 2701, so you would enter 123.456.789.10:2701.
As you can see, there are a couple of options available, but if you prefer to have full remote access to the Ubuntu graphical user interface, the VNC server method is certainly the best.