Learning and Sharing
  • Home
  • Blog
  • Linux
  • macOS
  • Virtualization
    • VMware
    • VirtualBox
  • Windows
    • Windows 11
    • Windows 10
    • Windows Server
  • Series
    • Symantec
    • Intune
    • Microsoft Azure
    • Powershell
    • VirtualBox
    • VMware
    • PowerShell Learning
    • Microsoft Graph
  • More
    • Auto Installation
    • AEC Installation
  • Contact
No Result
View All Result
  • Home
  • Blog
  • Linux
  • macOS
  • Virtualization
    • VMware
    • VirtualBox
  • Windows
    • Windows 11
    • Windows 10
    • Windows Server
  • Series
    • Symantec
    • Intune
    • Microsoft Azure
    • Powershell
    • VirtualBox
    • VMware
    • PowerShell Learning
    • Microsoft Graph
  • More
    • Auto Installation
    • AEC Installation
  • Contact
No Result
View All Result
No Result
View All Result

How to Enable Remote Desktop on Ubuntu Desktop

November 30, 2022
in Blog, Linux, Ubuntu
0
ADVERTISEMENT

Table of Contents

Remote Desktop Protocol (RDP) is a network protocol developed by Microsoft that allows users to remotely access and interact with the graphical user interface of a remote Windows server. RDP works on the client-server model, where an RDP client is installed on a local machine, and an RDP server is installed on the remote server.

In this post, you will install and configure an RDP server using xrdp on an Ubuntu Desktop and access it using an RDP connection.

Installing xrdp on Ubuntu

xrdp is an open-source implementation of the RDP server that allows RDP connections for Linux-based machine. In this step, you will install the xrdp on your Ubuntu Desktop.

1. To install xrdp, run the following command in the terminal:

sudo apt install xrdp -y

2. After installing xrdp, run the following commands to start xrdp, enable on boot and add a firewall rule.

sudo systemctl start xrdp
sudo systemctl enable xrdp
sudo ufw allow 3389

3. Verify the status of xrdp service using systemctl:

sudo systemctl status xrdp

This command will show the status as active (running):

● xrdp.service - xrdp daemon
     Loaded: loaded (/lib/systemd/system/xrdp.service; enabled; vendor preset: enabled)
     Active: **active (running)** since Sun 2022-08-07 13:00:44 UTC; 26s ago
       Docs: man:xrdp(8)
             man:xrdp.ini(5)
   Main PID: 17904 (xrdp)
      Tasks: 1 (limit: 1131)
     Memory: 1016.0K
     CGroup: /system.slice/xrdp.service
             └─17904 /usr/sbin/xrdp

Fix black screen when remote desktop to Ubuntu

In some cases, you would get the black screen when remote desktop from Windows to the Ubuntu machine.

This situation will happen (or can happen) when the same user account is used concurrently locally and remotely. In other words, the problem is related to the fact that the same user account is already logged in locally and a remote connection is attempted at the same time.

To solve this issue, there is a simple fix. You need to ensure the account you are using to login via the remote desktop client is not currently logged on locally on the Ubuntu target machine. If this is the case, perform a logout operation.

Try again the remote desktop session and you will be able to perform your remote desktop connection and that your desktop interface will be loaded and made available for you.

Alternatively, you can modify your /etc/xrdp/startwm.sh file and appending a one liner that will allow you to basically acquire the desktop while performing your remote connection even if you are already logged on locally.

sudo nano /etc/xrdp/startwm.sh

At the below line before this line test -x /etc/X11/Xsession && exec /etc/X11/Xsession. Then save the file.

Note Tip: To save the file in nano editor, press > >
export $(dbus-launch)
#!/bin/sh
# xrdp X session start script (c) 2015, 2017 mirabilos
# published under The MirOS Licence

if test -r /etc/profile; then
        . /etc/profile
fi

...
export $(dbus-launch)
test -x /etc/X11/Xsession && exec /etc/X11/Xsession
exec /bin/sh /etc/X11/Xsession

Then restart the xrdp to take the change goes into effect.

sudo systemctl restart xrdp

Now, you can give it a try. Stay logged on locally on the machine and initiate your remote session.

#/bin/sh
###Update the system
sudo apt update -y && sudo apt upgrade -y

###Install xrdp
sudo apt install xrdp -y

###Enable on boot and add firewall rule
sudo systemctl start xrdp
sudo systemctl enable xrdp
sudo ufw allow 3389

###Fix black screen
sudo sed -i '32 i export $(dbus-launch)' /etc/xrdp/startwm.sh
5/5 - (1 vote)
Previous Post

Make a Bootable Windows 11 USB Drive from a Mac with Terminal

Next Post

Black Screen Remote Desktop to Ubuntu from Windows with XRDP

Related Posts

Running Hyper-V and VMware Workstation on The Same Machine

August 15, 2024

How to Uninstall All Autodesk Products At Once Silently

July 29, 2024
Ftr5

How to Uninstall the Autodesk Genuine Service on Windows

July 29, 2024
Ftr19

How to Fix Windows Cannot Read the ProductKey From the Unattend Answer File in VirtualBox

July 26, 2024
Ftr25

How to Update Windows Terminal in Windows 10/11

July 26, 2024

How to Disable The Beep Sound in WSL Terminal on Windows

July 26, 2024

Leave a Reply Cancel reply

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

Recent Posts

  • How To Turn On uBlock Origin Extension in Chrome (2025)
  • Images Hidden Due To Mature Content Settings In CivitAI
  • Azure OpenAI vs Azure AI Hub, How to Choose the Right One for Your Needs

Categories

Stay in Touch

Discord Server

Join the Discord server with the site members for all questions and discussions.

Telegram Community

Jump in Telegram server. Ask questions and discuss everything with the site members.

Youtube Channel

Watch more videos, learning and sharing with Leo ❤❤❤. Sharing to be better.

Newsletter

Join the movement and receive our weekly Tech related newsletter. It’s Free.

General

Microsoft Windows

Microsoft Office

VMware

VirtualBox

Technology

PowerShell

Microsoft 365

Microsoft Teams

Email Servers

Copyright 2025 © All rights Reserved. Design by Leo with ❤

No Result
View All Result
  • Home
  • Linux
  • Intune
  • macOS
  • VMware
  • VirtualBox
  • Powershell
  • Windows 10
  • Windows 11
  • Microsoft 365
  • Microsoft Azure
  • Microsoft Office
  • Active Directory

No Result
View All Result
  • Home
  • Linux
  • Intune
  • macOS
  • VMware
  • VirtualBox
  • Powershell
  • Windows 10
  • Windows 11
  • Microsoft 365
  • Microsoft Azure
  • Microsoft Office
  • Active Directory