DEV Community

Kaarunakaran
Kaarunakaran

Posted on

RDP in Linux

Most Linux machines do not have RDP enabled. Use SSH or install a desktop environment like xRDP.

To enable Remote Desktop Protocol (RDP) on an Azure Virtual Machine running Linux, you will need to install a desktop environment and an RDP server like xRDP. Here are the steps to do that:

Step 1: Create and Access Your Azure VM

  1. Create the VM:

    • Log in to your Azure Portal.
    • Create a new VM, select the appropriate options for your needs (OS, size, etc.).
  2. Access the VM:

    • Once your VM is created, access it via SSH:
     ssh your-username@your-vm-ip-address
    

Step 2: Install Desktop Environment and xRDP

  1. Update the package list:
   sudo apt update
Enter fullscreen mode Exit fullscreen mode
  1. Install a desktop environment (e.g., Xfce):
   sudo apt install xfce4 xfce4-goodies
Enter fullscreen mode Exit fullscreen mode
  1. Install xRDP:
   sudo apt install xrdp
Enter fullscreen mode Exit fullscreen mode
  1. Enable and start the xRDP service:
   sudo systemctl enable xrdp
   sudo systemctl start xrdp
Enter fullscreen mode Exit fullscreen mode

Step 3: Configure xRDP

  1. Add the xRDP user to the ssl-cert group:
   sudo adduser xrdp ssl-cert
Enter fullscreen mode Exit fullscreen mode
  1. Set Xfce as the default session for xRDP:
   echo xfce4-session >~/.xsession
Enter fullscreen mode Exit fullscreen mode
  1. Restart the xRDP service:
   sudo systemctl restart xrdp
Enter fullscreen mode Exit fullscreen mode

Step 4: Open Port 3389 on Azure Network Security Group (NSG)

  1. Go to the Azure Portal.
  2. Navigate to your VM and select Networking under Settings.
  3. Add an inbound port rule for port 3389.

Step 5: Connect to Your Linux VM via RDP

  1. Open Remote Desktop Connection on your local machine.
  2. Enter the IP address of your Azure VM.
  3. Log in using your username and password created on the VM.

You should now be able to access your Linux VM using RDP.

Top comments (0)