Connect via RDP to Ubuntu 14.04 using XRDP

Enter your Ubuntu credentials
Print Friendly, PDF & Email

This is an update of a previous post, found here. I’ve added a section to the bottom which explains how you can connect to the same session each time.

If you need to connect to a Linux machine, and in the scope of this guide, Ubuntu 14.04 (I’m sure this guide should be fine for earlier versions as well), then your options include:

  • Pure and simple SSH – The admin’s super tool! (just install openssh-server – works every time!)
  • VNC – I don’t like this method because you need to install software on your client AND server
  • XRDP – This still involves VNC to some degree but you can use the normal Windows Remote Desktop Client

The latter is the one I’ll guide you through here.

In my example, I need to connect to my home PC. If you’re trying something similar, it is assumed that proper port forwarding has been setup on your home router/firewall. In short, you need to point port 3389 (RDP Port) to the home pc, or whichever server you are connecting to. Unity is not currently supported. As such, we will use XFCE as the Window Manager.

So, on the home PC, here’s what you do
Step 1:Install XRDP and xfce4

user@techedemic-home:~$sudo apt-get install xfce4 xrdp

Step 2:Execute the following to make xfce4 the default window manager for the RDP connections

user@techedemic-home:~$echo xfce4-session > ~/.xsession

Step 3: Time to try it. In my case, I’m connecting from work via RDP to my home pc

Connect via the normal windows remote desktop client

Connect via the normal windows remote desktop client



Step 4: You will be prompted for your credentials. Use the same as you normally use to log onto your Ubuntu PC
Enter your Ubuntu credentials

Enter your Ubuntu credentials



Step 5: You’re in and you’re working over RDP
Your xfce4 desktop should open

Your xfce4 desktop should open

At this stage you might think: “Hey, sorted! I can do all my things remotely even from a Windows PC”. While you would be right, you will also soon run into a very common problem. If you disconnect from the RDP session and connect again, a new session is created and you will not have access to running programs in the first session you were connected to.

Thankfully, this is Linux and as such, where there is a will there is a way.

Step 6: Modify the xrdp.ini file to allow you to change the host port you are connecting to

# Open /etc/xrdp/xrdp.ini in your favourite editor. 
# Look for the section named [xrdp1]
# In this section, replace the following line
port=-1 
# with 
port=ask-1

Step 7: Restart xrdp

user@techedemic-home:~$sudo service xrdp restart

Step 8: Connect again

Connect via the normal windows remote desktop client

Connect via the normal windows remote desktop client

Step 9: When prompted, enter your credentials (note the extra field)

Enter your Ubuntu credentials

Enter your Ubuntu credentials (Note the extra field – do not change at this stage)

Step 10: The system will connect and some status messages will be written to the screen. Pay special attention to the VNC port number used, in my case 5911 (indicated by red circle below)

xrdp 'Connection Log'

xrdp ‘Connection Log’

Step 10: The next time you need to log in to the same session, enter the applicable port number (in my case ‘5911’) and you will be connected to the same session

Enter the port number

Enter the port number

3 comments

  1. Hello Hello,

    I have used the following step by step guide to perform the same operation (http://c-nergy.be/blog/?p=5305). Reading through the blog mentioned above, if you are using ubuntu 14.10, you do not need to change anything in order to reconnect to the same session

    This info might be useful to other people

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.