How to access to Raspberry Pi Desktop using the remote desktop protocol.
I decided to setup one of my Raspberry (a P4 with 4Gb RAM) to use it as a remote desktop. I want to use it from my iPad or from my Mac every time I need to use some software or every time I want to use VSCode and write some code from my iPad. Spoiler: doing a “apt-get install xrdp” it’s not enough.
Setup xrdp
This is the easier part: xrdp is the opensource implementation of the Microsoft RDP (Remote Desktop Protocol), once installed and configured the user’s desktop will be available through a RDP client (for example the one available out of the box on Window). On iOS and on Mac OS I installed the official Microsoft clients (downloadable from the official stores).
To download and install xrdp is easy as do:
apt-get install xrdp
Configuring xrdp
Installing xrdp is not enough due to some problems with the installation process you have to do something more.
First of all: using the raspi-config tool set up Raspberry OS to boot in graphical mode but disable the the ‘auto-login’ mode.
Even doing that the ‘pi’ (default) user won’t be able to access through RDP. A work-around: create a new user, add it to the ‘sudo’ group and allow it to use the sudo command without have to insert the password every time.
Create the new user:
sudo adduser mynewuser
Now add it to the sudoers group:
sudo adduser mynewuser sudo
And let ‘mynewuser’ to use the ‘sudo’ command without digit the password: essentially you have to create a file, with the following content, inside /etc/sudoers.d:
echo ‘mynewuser ALL=(ALL) NOPASSWD: ALL’ | sudo tee /etc/suoders.d/010_mynewuser-nopassw
Replace ‘mynewuser’ with the real username you want to create.
Last but not least, activate the service:
sudo service xrdp start
Et voilà, that’s all folks!