RDP to a Linux VM in Azure

I needed to RDP into a Linux VM in the Cloud. Briefly these are the steps. (I needed these myself).

The following are the steps briefly.

1. Bring up your Linux VM in Azure.

2. Open port 3389 for inbound connections to the Linux VM from the NSG rules for the VM in Azure.

3. Reboot.

4. Use a terminal like PuTTy and terminal into the Linux VM using its public IP.

5. Run the following commands.

5.1. sudo apt-get update

5.2. sudo apt-get install lxde

5.3. sudo apt-get install xrdp

6. make entries in init.d to start the lxde  ( sudo /etc/init.d/xrdp start)

7. Create an .xsession file in the user's profile by:

echo startlxde > ~/.xsession

8. From your windows box start RDP and connect using public IP address.

9. If it failed, try restarting the XRDP in Linux by using the following command.

sudo service xrdp restart