Home » Headline, Linux, Networking, Technology

How To Remote Access Ubuntu Desktop

6 March 2009 2,214 views Comments

Written by: Shamim

Remotely accessing a computer is a great advantage to all IT professionals. Sometimes you need to troubleshoot a computer located in a far off corner of the world. Sometimes you just want to access that file you left on the desktop of your home computer from work. This has always been pretty easy to accomplish in the Windows realm using Logmein.com, but doing the same feat in Linux takes a little more knowhow. Till Logmein comes up with a Linux application that I can use, I’ll be using the built in VNC server feature of Ubuntu desktop for remote access.

VNC Server Setup

VNC is a server software that needs to run on the desktop so that it can be controlled remotely. Here is how you need to set it up to access a Ubuntu desktop machine from anywhere.

First go to System -> Preferences -> Remote Desktop as seen on the screenshot below. Here you will set up the permissions and other features that you need for remote access.

system-pref-remote-desktop

Secondly, on the remote Desktop Preferences window you need to enable remote desktop access. (By default remote desktop feature is turned off since its a security risk.) To remove any confusion here is the meaning of the options in plain English.

  • Sharing – The option for others to view your desktop is needed to turn on the remote access feature. If you want someone to have only viewing privileges then you don’t need the second option for others to control your desktop. But for the most of us who needs to access their own computers remotely this option must be turned on as well. As soon as both options are filled out a highlighted field appears which specifies what IP address the computer is available at outside your network. Not down this IP address because you will need it to access your machine.
  • Security – The first option for confirm each access would give an on-screen prompt whenever anyone is trying to remotely access the computer. Remember to turn this option off if you want to be able to remotely control your desktop. The second optional feature for setting a password. This will generate a prompt when you try to remotely log in. The next option should be checked automatically for any network changes that might affect your connection. It is a good idea to keep this option checked.
  • Notification Area – The notification area options do not affect remote access functionality. Set them to your liking. The notification icon will appear on the top right of your Gnome panel – next to date/time and network connectivity icons.

remote-desktop-pref

Router Setup – Port Forwarding

This is the last step of the remote access setup. You need to set up the router to access your desktop from outside your home network – such as from work or from a friends house or from the moon (if only ;) ). In simple terms when you try to access your desktop from (say) your work network, you will be trying to reach the IP address (that you noted down in the previous step) over port 5900. This port is needed for communicating with the VNC server running your desktop. So for your home router to understand how to handle the VNC traffic you need to specify that any data that comes to the router from any outside source – please forward it to my home computer at a certain local IP address in a format such as 192.168.0.100 or something similar.

Let’s find out what the IP address of your computer and the router is. First open up a terminal prompt by going to Application -> Accessories -> Terminal.

STEP 1: Now type in ifconfig -a and press enter. This will give your IP address. If you have multiple network connections then all will be displayed. For most people the section of interest will be under eth0 or wlan0. You computer’s address is specified in inet addr: . Note this down and you will need this when configuring the router.

STEP 2: Now in the same terminal window type in route and note the line starting with default …. – the second column of that line will give you the router’s IP. In the below example: the router is 192.168.1.1

ifconfig-route

Now it’s time to configure the router. Open your favorite web browser and type in the IP adress of the router that you received in Step 2 above. In the router menu links look for Port Forwarding. Then setup port forwarding for TCP ports 5900, 5901 and 5902 to your cmoputers IP address. It should look something like the below screenshot.

router-port-frwd

That is all you need to setup VNC on your Ubuntu desktop to access to from anywhere.

Most Commented Posts

Did you enjoy this article? Subscribe to our RSS feed or get updates via email. Latest Posts on TechVirgin

  • The last sentence sums up quite nicely - if you want to lazily access the Ubuntu desktop without typing much then VNC is the way to go. Otherwise, as you said, SSH would be a better option. Thanks for sharing Chris.
  • Firstly, this has been available for Linux more or less since X began, so it's nothing new and nothing exciting and it predates LogMeIn by about 20 years or so. It is also much, much less secure than LogMeIn but I will explain why in a moment.

    This is not the best way to access your own computer. This is the best way for other users to access your computer on a view-only basis. If you want to access your own computer, use another linux/unix/bsd host and use the command "ssh -X". You will need to enable the remote terminal (ssh) service using the system>administration>services dialogue.

    X over SSH is, as you should already know, encrypted. It also only allows much greater control over user rights, should you want other (less trustworthy, and believe me - everyone is less trustworthy than you with your computer) users to use the service you should use the useradd command and give them their own UNIX account which you can then set up to allow them to use what you want them to use and disallow everything else.

    VNC is, by default, unencrypted and does not require a user account (and only optionally requires a password). It is a good idea to set a password, but we'll move on to why that isn't strictly necessary in a moment. The reason for its lack of security is because VNC is intended for use only on trusted networks - not over the internet. You should set up VNC without that third (UPnP) option, unless you want the entire world to have access to your computer. You can set a password, but you should rather avoid the port forwarding and simply tunnel VNC over a VPN should you want to connect from elsewhere. Since you are always connecting from a trusted host, it is ok not to set a password. However, should you be connected to (for example) a University network, it is advisable to set one anyway. That is if you are even ballsy enough to use VNC on a Uni network - it seems a bit silly to "trust" a network which is literally full of students (some of which, presumably, are studying computer science).

    So, to sum up:
    XoSSH (ssh -X) is for remote access.
    VNC (vinagre) is for remote viewing.

    On one final note, anybody who has actually compared the two technologies will agree on more than just a security standpoint - the remote control features of VNC leave a lot to be desired (as do the remote viewing features of XoSSH, for that matter, which is oddly how I came across this article - I was looking for information on setting up VNC to remotely view my computer from a laptop, because I'm lazy like that)
blog comments powered by Disqus