November 12, 2024

How to RDP into Linux Mint/Ubuntu from Windows

Hey there! Today I’m going to show you how to RDP into Linux Mint or Ubuntu from a Windows machine. I personally work on multiple computers and I need to remotely connect to one or another. Since I tried multiple solutions like VNC, none of them worked smoothly enough. Some keys are not mapped properly, there are huge delays and stuff like that.

Hence I wanted to setup a solution to connect to my Linux Mint machine from Windows with RDP. Works fine and is perfect for my scenario. But setting up an RDP server on Linux is not really plug and play so I’ll lay out the steps that I did to make it work here in this article.

RDP into Linux: XRDP package to the rescue

In order to make it work, we’ll use XRDP on our host Linux machine. Just install it with this simple command:

sudo apt install xrdp 

After the installation, the XRDP service automatically starts on the standard RDP port and is ready to accept connections. But there are some further steps to take for it to work.

First of all, generate a PEM certificate and key with this command:

$ req -x509 -newkey rsa:2048 -nodes -keyout key.pem -out cert.pem -days 865

The copy these two to your xrdp config folder and make them accessible:

$ sudo mkdir -p /etc/xrdp/ssl
$ sudo cp cert.pem /etc/xrdp/ssl
$ sudo cp key.pem /etc/xrdp/ssl

Then edit the XRDP config file /etc/xrdp/xrdp.ini to point to these new certificates:

certificate=/etc/xrdp/ssl/cert.pem
key_file=/etc/xrdp/ssl/key.pem

Now, in case you’re running Linux Mint with Cinnamon, you’ll need to run this command to make XRDP start the Cinnamon X Server:

$ echo "env -u SESSION_MANAGER -u DBUS_SESSION_BUS_ADDRESS cinnamon-session" > ~/.xsession

After this step, if you try to login to your machine via RDP, it will work but after you login you’ll notice there’s no response to mouse or keyboard events. So we need to add this CoreKeyboard and CorePointer to the Xorg configuration file /etc/X11/xrdp/xorg.conf like exemplified below:

Section "InputDevice"
    Identifier "xrdpKeyboard"
    Driver "xrdpkeyb"
    Option "CoreKeyboard"
EndSection

Section "InputDevice"
    Identifier "xrdpMouse"
    Driver "xrdpmouse"
    Option "CorePointer"
EndSection

This should fix the mouse and keyboard problem and now you can enjoy your fully remote desktop experience 😉

Testing it out

Right now, I’m on my Windows computer and I opened up my Remote Desktop connection. I connected to my Linux Mint machine whose name on the network is afivan-zen (it also works with an IP address). After I accepted the certificate, I was presented with this login screen:

Then I logged in with my password and Voila! My Cinnamon desktop loaded just fine. Bear in mind that it will start a separate session and this will not end any other session you may (physically) have on your Linux machine.

There you go, you can now see that the whole piece is RUNNING! Hooray! 😄

Conclusion

I think having this RDP connection ready to be used on your Linux machine can be a game changer compared to other solutions like VNC which sometimes are glitchy. Still, at least in my case this connection is not super-accelerated so I cannot watch movies on the remote machine but I can code and play with my beloved Linux machine just fine. So for those of you who attempt this, hope it works good as well. Just let me know in comments if you spot any issues.

Thanks for reading, I hope you found this article useful and interesting. If you have any suggestions don’t hesitate to contact me. If you found my content useful please consider a small donation. Any support is greatly appreciated! Cheers  😉

afivan

Enthusiast adventurer, software developer with a high sense of creativity, discipline and achievement. I like to travel, I like music and outdoor sports. Because I have a broken ligament, I prefer safer activities like running or biking. In a couple of years, my ambition is to become a good technical lead with entrepreneurial mindset. From a personal point of view, I’d like to establish my own family, so I’ll have lots of things to do, there’s never time to get bored 😂

View all posts by afivan →