Tuesday, December 1, 2009

How to Establish Simple Remote Desktop Access Between Ubuntu and Windows

Teamviewer and LogMeIn are applications of choice for most Windows users when it comes to learning how to connect to a remote desktop. They are easy to use and don’t require any configuration. Sadly, both of them are not available on Linux. You can mess around trying to get them working in WINE but that would hardly be the ideal solution, especially when there are native tools available for remote desktop access for Ubuntu.
So let’s get started right away.
Adept Ubuntu users would already be thinking about the System > Preferences > Remote Desktop menu entry. Of course we will use that. However, it lets you configure your computer to allow/disallow remote desktop access. It doesn’t let you connect to a remote computer. Extra software is required for that, which we now look into.

Allow Remote Desktop Connections

First off, you would need to enable remote desktop on the Linux computer that you want to access via remote desktop. Doing so is easy by using the System > Preferences > Remote Desktop option. In the dialog that shows up – check “Allow other users to view your desktop”. You can also configure additional options like requiring password for remote access and notification icons. It is advisable to use a password for remote access, so that only trusted users may be able to establish a connection.
how do i connect to a remote desktop
With all that set up, its time to connect to it from another computer. Two possible scenarios arise: you can connect using another Linux machine, or you might want to connect using a Windows PC. Both require slightly different approaches. Here’s how.

Connecting From Another Linux Machine

Ubuntu uses Virtual Networking Connections for remote desktop. Your best bet would be to use a VNC viewer to access the remote desktop. Use the command sudo apt-get install xvnc4viewer to install VNC viewer. Now all you have to do is to issue the vncviewer <hostname/ip> command. You will be asked for a password (if it is configured on the remote machine) and you can then view and interact with the remote desktop.
how do i connect to a remote desktop

Connecting From A Windows PC

If you would to connect from a Windows computer, you can use TightVNC or uVNC (There is also a seemingly portable version available that would run off your USB drive without installing, however it stores entries in the registry). Specify the IP address and the port number (default is 5900 and is not required to be mentioned explicitly), specify bandwidth that is available to you, hit Connect and you can access the desktop of the remote machine easily.
how do i connect to a remote desktop
Mac users can also use their favorite VNC client (like Chicken of the VNC) and you should be able to remotely access the desktop of the said Linux machine.
Keep in mind that none of these clients support encryption and you have only established an unencrypted connection up until now. Teamviewer and LogMeIn encrypt the the data flow between the two computer. You can use a SSH tunnel to encrypt the flow of data. Here are the steps in brief:
  • You need OpenSSH. (sudo apt-get openssh-server).
  • Create the tunnel using ssh -L 5900:localhost:5900 <ip address>, where IP address is the address of the remote computer. If you are connecting using a Windows computer, you can use PuTTY to create a tunnel.
  • Establish the connection as before however, this time you need to connect to localhost at port 5900 (or whatever port you specified in the command above). VNC client will then utilize the tunnel you just created and traffic between the two endpoints will now be encrypted.
remote desktop connection
While this a lot of work compared to the one-click solution offered by Teamviewer or LogMeIn, it is certainly more configurable and caters to a wide variety of needs. Moreover, you only need to do the configuration once and you can also establish a VNC connection with a headless server (with some more configuration though!).