Monday, January 12, 2015

How to use Windows RDP to Access your Ubuntu Instance

Recently, I was playing around OpenStack and was helping to setup Ubuntu instance lab. After installation, I found there has variance information regarding how to connect Ubuntu instance via Windows RDP. Here, I would like to quick share what's I found hopefully it helps for you. 

Here are the Ubuntu Instance I try

  • Ubuntu 12.04 LTS Image
  • Ubuntu 13.10 Image
  • Ubuntu 14.04 Image

For Ubuntu 12.04

Let's start with Ubuntu 12.04 first since it's different from 13.10 and 14.04.

1. Install XRDP
sudo apt-get install xrdp

2. Start XRDP Service
sudo /etc/init.d/xrdp start

3. Create a new user that you will use to log into the XRDP, when you create the new user, linux will ask you couple default questions which includes password.
sudo adduser USERNAME 
eg: sudo adduser johnnyvnc

4. Grant user sudo access allows to install applications
sudo adduser USERNAME sudo 
eg: sudo adduser johnnyvnc sudo

5. Switch to USERNAME
su USERNAME
eg: su johnnyvnc

6. Install gnome-session-fallback. (Because we can use gnome native desktop session in Ubuntu 12.04, we need to install fallback)
sudo apt-get install gnome-session-fallback

7. Setup configuration for gnome session under USERNAME root path.
sudo echo 'gnome-session -session=gnome-fallback' > ~/.xsession 

8. Restart XRDP service
sudo /etc/init.d/xrdp restart

9. Connect Ubuntu via Windows RDP




For Ubuntu 13.10 and Ubuntu 14.04

Ubuntu native gnome is not working on 13.10 and 14.04 yet. We have to use alternative way which is xfce4 for RDP from Windows.

1. Install xfce4 (After previous 1 ~ 6 steps, now we need to install xfce4.)
sudo apt-get install xfce4

2. Setup configuration for xfce4
At this stage, you have to configure your Ubuntu machine in order for xrdp to know that the xfce desktop will be used instead of the Unity or Gnome (which are not working anymore in Ubuntu). To configure this, from the terminal console, you will issue the following command
sudo echo xfce4-session > ~/.xsession

sudo vim /etc/xrdp/startwm.sh

change the file content as below.

#!/bin/sh
if [ -r /etc/default/locale ]then  . /etc/default/locale  export LANG LANGUAGE
 
fi
startxfce4







Now enjoy it.

No comments:

Post a Comment