Enabling SSH and Remote Desktop Access
Allowing fully graphical remote access to your Lubuntu machine can be useful. Some ways it might be used are:
- Remote support -- the remote person helping you can see your screen and show you what to do
- Training -- main student machines can watch an instructors screen on their own screens
- Using a home PC from work, or a work PC from home
- Using multiple machines without even getting up from your chair!
This document will describe setting up an Lubuntu machine for secure remote graphical access, the main use case described will be a home or small office user with an Lubuntu PC that is connected to the Internet via a router.
Summary For The Very Impatient
On the Lubuntu computer:
sudo apt-get install openssh-server vino -y vino-preferences # Check appropriate boxes as needed # Preferences -> Desktop Session Settings, Check "Remote Desktop" # Log out of Lubuntu PC, log back into it again locally # Set up forwarding of port 22 in router
On the other computer that will control/view the Lubuntu machine:
sudo apt-get install xtightvncviewer -y ssh -L 12345:localhost:5900 email@example.com xvncviewer localhost:12345 &
Installing an SSH server
Because the Internet is a useful but unsafe place, securing any kind of remote access to your Lubuntu machine is important. To do this, we will not allow direct access from the Internet to the remote desktop service (vino), but only allow SSH access, and then users who can SSH into the Lubuntu machine can connect to its vino server that way, securely, keeping all passwords and information safely hidden from prying eyes.
Installing the standard Ubuntu SSH server on Lubuntu is easy:
sudo apt-get install openssh-server
This service will start running as soon as it is installed. To verify this, you can do
and answer yes to the question about the unknown fingerprint and do you want to continue connect, and then providing your password. You will then log in to your own local computer over SSH. This is pretty useless, except as a test, so type
to end that SSH session.
Configuring your Router
To allow access from the Internet, you need to "open" the SSH port (port 22 by default) in the router and tell it to allow incoming SSH connections to go to your Lubuntu PC. Details of doing this are outside the scope of this page, but some helpful information can be found at http://portforward.com
Testing SSH Access to Lubuntu
If you have another computer on the same local network as your Lubuntu PC, you can test access to Lubuntu from that computer using
if you replace "you" with your Lubuntu username, and "192.168.1.2" with the actual local IP address of your Lubuntu PC.
Otherwise, once your router is configured, from a computer "out there" on the Internet you can use
if you replace "you" with your Lubuntu username, and "184.108.40.206" with the public (Internet) IP address of your router. One way to find out this address is to browse to http://whatismyip.com and look for the line saying "Your IP address is". Ignore everything else on the page!
If, after entering yes about the fingerprint and then entering your password, you get a text screen with a prompt line that looks like
then you now have working SSH access from anywhere on the Internet. What is left is to allow graphical "remote desktop" access too.
Note: if you wish to set up SSH public key access, that's great, but it is described elsewhere and so not documented here.
Installing and Configuring Vino
One commonly used application for remote desktop access in Ubuntu is Vino. This works well in Lubuntu, too, and you can install it by doing
sudo apt-get install vino
As a security precaution, this software does NOT start automatically as soon as it is installed. It needs to be configured first. To do this, type the command
and under the Sharing heading, check the "Allow other users to view your desktop" and then the "Allow other users to control your desktop" checkboxes.
Under the Security heading, for easy remote use of a PC when there is no one physically at its keyboard, check only the "Configure network automatically to accept connections" checkbox.
Lastly, under the Notification Area heading, select whichever option you prefer. "Always display an icon" is the safest choice, because seeing the icon will remind you that vino is running and enabled.
Click the "Close" button to save your changes to vino's preferences. Before actually using it remotely, you will need to tell your desktop to start vino automatically when you log in. You do this by using the "Desktop Session Settings" program which is in the "Preferences" menu. In the "Desktop Session Settings" screen, look for "Remote Desktop" and click the checkbox in the "Enabled" column so there is a check mark in it.
Now log out and back in to Lubuntu, or reboot the Lubuntu PC and then log back in.
Starting Remote (VNC) Access to Lubuntu
On a remote PC, you will need a VNC viewer program to see and control your Lubuntu PC, as well as ssh. There are several VNC viewers for both Windows and Linux. If the remote PC is also a Ubuntu or Lubuntu PC, you can do
sudo apt-get install xtightvncviewer
to install one of these viewers.
Then ssh into the Lubuntu PC as earlier, but with an extra option to create a tunnel to the vino (VNC) server too.
ssh -L 12345:localhost:5900 firstname.lastname@example.org
should work (replacing "you" and "220.127.116.11" as before). The "12345" can be any number you like that is over 1024 and under 65536, as long as that port is not in use on the machine you are typing at. The number 12345 works fine, and is easy to remember
Once you provide your password and see the
prompt from the remote Lubuntu PC, you can type at the local PC (not at that prompt!) the command
vncviewer localhost:12345 &
If all is well, you will see a copy of your remote Lubuntu PC and can use it just as though you were physically at that PC (just don't power off, reboot, or log out of the remote PC, as you will have no easy way to power it back on and log back into it remotely!).
Ending Remote VNC Access to Lubuntu
To disconnect from the remote Lubuntu PC, you can either click on the vino notification icon (a little monitor-like image near your clock, lower right of the Lubuntu screen) and then click "Disconnect whatever" ("whatever" will be the name or IP address of the remote computer at which you are sitting), or, you can simply close the vncviewer window by clicking on the "x" at the top right (Lubuntu) or top left (Ubuntu) of that window.
prompt to close the SSH connection.
https://help.ubuntu.com/community/VNC is a broader discussion of using VNC with Ubuntu. Note that it seems to have some typos (port 5500 vs port 5900 for example).