- slide 1 of 5
Remote desktop has become a popular method for working from home, usually involving employees connecting remotely from a home PC to a hosted session at their usual place of employment. However, this isn’t always possible, which is why ad hoc situations occur whereby the end user sets up an unofficial remote desktop system, usually via a VNC (virtual network computing) connection.
This is less than ideal. For a start off, it often requires a bit of political messing about with your employer, but most importantly it can be difficult to remote connect to a computer and keep what you’re doing under wraps. With Windows it is easy enough to start a new session, but under Linux Ubuntu this is a bit trickier to sort out.
There are two ways to connect to a remote Linux computer, either via SSH or by creating a hidden VNC session. Each is easily achieved with the right software on your computer.
Image credit: Wikimedia Commons/Sertion
- slide 2 of 5
Benefits of Locking the Remote Desktop
So how do you protect the tasks you are carrying out from the beady eyes of observers? After all, if you’re using a remote desktop method, popping into work to unplug the monitor is hardly practical!
Instead, some method of locking the Ubuntu remote desktop is required. What this will do is either allow you to lock your computer remotely while you work in a separate, hidden session, or it will allow you to carry on working in a hidden session while someone else uses your computer or the machine stands idle.
There may be many reasons why you would want to do this, from the usual privacy related issues to something more unusual; for instance, you might be on a secondment to another organization for a short time, and wish to keep matters confidential.
Either way, the SSH method of remote connection and the more visually pleasing GUI method are both available for you to use.
- slide 3 of 5
Connect by SSH to the Remote Computer
One option you might try is SSH. This will require you to have an SSH server on the target (Ubuntu) computer and an SSH client on the computer you are working from.
For instance, if your home PC is Windows XP and you’re attempting to remote to a Linux Ubuntu machine at work you might use SSH Secure Shell on the Windows machine and OpenSSH server for your Ubuntu computer.
Installation of OpenSSH is pretty simple, and is best achieved via System > Administration > Synaptic Package Manager, where you will need to search for openssh-server. Once you have found it, right-click and select Mark for Installation, click Mark and then Apply the change, following any on-screen instructions.
Once this is completed, you will need to know the IP address of the computer you are planning to remotely connect to in order to use your SSH client.
Note, however, that using the SSH method of connection will require you to work via the command line only. While graphical programs will be available, you won’t be able to access the Ubuntu desktop via the traditional graphical user interface. In order to do this, you will need the second method.
- slide 4 of 5
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.
- slide 5 of 5
- Author’s own experience.
- Ubuntu Forums