Code Robo
Formatter
Comparator
Tester
Merger
Converter
Utility
Java Code Complience
Validator
EncoderDecoder
Virtual Service
How to connect AWS ec2 ubuntu instance using Remote Desktop Connection (any RDP) in GUI mode
       Talk to EasyAssistant

Connecting AWS ec2 ubuntu instance from windows machine using Remote Desk Top (RDP) in GUI mode.

We alwyas prefer GUI over CUI. Linux ubuntu OS support GUI desktop version. But if the ubuntu is installed on remote machine, how to get the desktop view of the remote ubuntu machine. In this page we will discuss how to connect AWS ubuntu remote instance using Microsoft Remote Desk Connection (RDC / RDP) from windows laptop. Its very frustrating and business loss. I was not able to connect AWS lightsail instance through RDP because of upstream not found [519] error.
Please follow the following steps to connect to Ubuntu from RDP / RDC.

1. Create EC2 ubuntu instance in AWS console which we will connect from Remote Desktop Connection (RDP) available in windows laptop.
Ubuntu instance in AWS EC2


2. Connect your aws ubuntu instance using ssh to install required software and give permission.
Command : ssh -i "KeyPairCanada.pem" ubuntu@ec2-15-156-87-245.ca-central-1.compute.amazonaws.com
  • Copy the command from aws console as shown in screenshot.
    Ubuntu ssh connect

  • Open command prompt.
  • Go to the directory where aws private key (.pem file) is downloaded. Please do not copy the pem file to other location.
    Run the following command. Command can be copied from AWS console as shown in below screenshot
    run the Command : ssh -i "KeyPairCanada.pem" ubuntu@ec2-15-156-87-245.ca-central-1.compute.amazonaws.com
    Ubuntu ssh connect

    It will connect ubuntu instance in CUI mode.


3. Run Updates.

Command: sudo apt update
When it will ask for input, type 'Y' and press Enter key.

4. Upgrade it now.


Commands:

sudo apt upgrade

sudo sed -i 's/^PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config



When it will ask for input, type 'Y' and press Enter key.


5. Restart the service .

Commands: sudo /etc/init.d/ssh restart

6. Set the password for ubuntu user. .


Note: default user is ubuntu as of now. But it may be changed for your instance. Please check the default user for your AWS ubuntu instance.
Commands: sudo passwd ubuntu
Type the new password (e.g. easycodeforall)
Retypne new password to confirm.

7. Install xrdp in your ubuntu instance .

Commands: sudo apt install xrdp xfce4 xfce4-goodies tightvncserver

When it will ask for input, type 'Y' and press Enter key.

8. Run following commands and restart server .


Commands:

echo xfce4-session> /home/ubuntu/.xsession 

sudo cp /home/ubuntu/.xsession /etc/skel

sudo sed -i '0,/-1/s//ask-1/' /etc/xrdp/xrdp.ini

sudo service xrdp restart


Note: Copy the commad in nodepad first. update the "'" character and then copy and paste in ssh window.

9. Reboot ubuntu instance from WAS console or through commands from SSH client window.


Commands: sudo reboot


10. Connect again to your aws ubuntu instance using ssh .
Command : ssh -i "KeyPairCanada.pem" ubuntu@ec2-15-156-87-245.ca-central-1.compute.amazonaws.com

11. CInstall Putty in your aws ubuntu instance .
Command : sudo apt-get install putty


12. Now setup tunneling to your ubuntu instance from your laptop.

Launch Putty in your laptop. If it's not there, download and install it or download the zip version and use it.
  • Copy the public IP of your AWS ubuntu instanc and put it in the host name (as shown in below screenshot).
    Public IP in Host Name


  • Copy the private IP of your AWS ubuntu instanc and put it in Destination box with colon and port number 3389 (Navigation: Connections > SSH > Tunnels).
    Give destination port 8888
    Click on the add button
    Public IP in Host Name



  • Go to Connections > SSH > Auth. Select your aws private key (pem file).
    private key



  • Click on the Open button and accept it
    It will ask for userid and password. Please give ubuntu (it may be changed) as user and the password you have set in the previous step.
    It will connect and setup a tunnel. Remote desktop will use this tunnel to comunicate ubuntu server (ec2 instance)
    Public IP in Host Name




13. Connect using Remote Desktop Connection or any other RDP client.
Launch Remote Desktop Connection in your laptop..
  • Give 127.0.0.1:8888 in place of Computer .
    Public IP in Host Name

  • Give 127.0.0.1:8888 in place of Computer .
    . Give user ubuntu (it may change)
    Click on connect button.

    Connect ubuntu from RDC


It will connect the ubuntu instance.
Connected


14. Provide ubantu user password and get access of desktop of AWS ubantu instance in GUI mode .
Desktop


Post Your Comment:
Name :
Email ( Optional) :
Comments / Suggestion (* Required) It is required: :
: