Thin Clients, are computers which are optimized to establish a remote connection to a server and run using the remote resources. Usually those systems are not meant to be used for intensive tasks or gaming and they are mostly found in office environments. In the following guide you will find out how to use a Raspberry PI to connect to a local Windows Computer using Microsoft’s RDP Protocol.
Every version of Microsoft Windows following the release of Windows XP includes a Remote Desktop Connection (RDC) client (mstsc.exe). The Remote Desktop Connection is accomplished through the Client using the Remote Desktop Protocol a proprietary Microsoft Protocol which provides a graphical interface to connect to another computer.
1) A computer running Microsoft Windows XP or later.
2) A Raspberry PI Device. (Prefer a Raspberry PI 3 or 4 for performance reasons)
3) Network connectivity between the two devices. (If the devices are not in the same local network, port forwarding must be enabled at the router of the Computer’s network.)
Enable Remote Connections on Microsoft Windows 10
1) Open Control Panel
2) Click on System and Security
3) At the "System" section, click Allow remote access
4) A new window will pop up. Select the Remote tab.
5) Under the "Remote Desktop" section:
- check the Allow remote connections to this computer option
- check the Allow connections only from computers running Remote Desktop with Network Level Authentication option.
- Click OK and close the window.
Allow only Specific Users to login remotely. [Optional]
1) From the Remote Tab, click the Select Users… button
2) In the popup window click on Add button
2) Type the preferred username(s) using commas to separate them
3) Click the Check Names button, to validate username(s). If username(s) is/are valid username(s) on the current computer then the computer’s name will be prepended to the username(s).
Raspberry PI Setup
- Prepare a new sd-card with RaspiOS Lite (Version Used for this tutorial: January 11th 2021)
- In the boot partition of the sd-card create an empty file, name it "ssh" and make sure it has no extension.
- Insert the SD card in your Raspi, connect it to your local network and power it up.
- Establish an SSH connection to the raspi using the default credentials (pi/raspberry). Use the official guides for Windows or Linux or Mac if you haven’t use SSH before.
- After connecting using SSH, update and upgrade your distribution
sudo apt update sudo apt upgrade -y
- Install OpenBox Windows Manager and x11 Windowing System by running the following command.
sudo apt-get install --no-install-recommends xserver-xorg x11-xserver-utils xinit openbox xdg-utils -y
- Next, Install Remmina, an opensource Remote Desktop client with RDP support.
sudo apt install remmina -y
8.Make a configuration file at your home directory "/home/pi" and name it "windows.remmina".
Add the following contents to the configuration file (use: sudo nano /home/pi/windows.remmina): Change server from xxx.xxx.xxx.xxx to your computer’s IP address and username to the computer’s login username. The password will be requested when remmina run.
[remmina] sound=off sharefolder= resolution_mode=2 serialdriver= cert_ignore=0 console=0 name=Windows serialname= exec= clientname= shareserial=0 shareparallel=0 ssh_enabled=0 serialpath= colordepth=66 loadbalanceinfo= disable_fastpath=0 ssh_auth=0 postcommand= group= ssh_charset= resolution_height=0 server=xxx.xxx.xxx.xxx ssh_loopback=0 enableproxy=0 username=username_here ssh_password= ssh_username= gateway_server= gateway_password= sharesmartcard=0 quality=0 password= resolution_width=0 printername= microphone=0 gateway_username= serialpermissive=0 smartcardname= disablepasswordstoring=0 security= disableautoreconnect=0 execpath= gateway_usage=0 parallelname= precommand= glyph-cache=0 relax-order-checks=0 domain= parallelpath= ssh_server= protocol=RDP shareprinter=0 printerdriver= gateway_domain= disableclipboard=0 ssh_privatekey= gwtransp=http viewmode=1 window_maximize=1 window_width=1920 window_height=1080
Next, edit the file /home/pi/.profile (use: nano /home/pi/.profile) and append the following line at the end of the file.
[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && startx
Configure xinitrc by editing /etc/X11/xinit/xinitrc (use: sudo nano /etc/X11/xinit/xinitrc) :
Comment out the following line:
and add the following line:
Lastly, edit openbox configuration file (use: sudo nano /etc/xdg/openbox/autostart) and type the following commands at the end of the file to disable any form of Screen Saver, Screen Blanking and Power Management and set Remmina to launch when launching openbox :
xset s off xset s noblank xset -dpms remmina -c /home/pi/windows.remmina &
Configure console autologin
Run Raspberry PI configuration by typing:
Select "System Options"
At the next screen select "S5 Boot / Auto Login"
And finally, select "B2 Console Autologin"
Use the Arrow Keys (Right arrow twice) to move to the Finish Button
Before Reboot confirmation connect your Raspberry to an external screen and attach a Mouse and a Keyboard in order to be ready for the next step.
Establishing an RDP Connection
At this point everything is ready, your Raspberry will boot to OpenBox and Remmina will open asking to Accept the Certificate for the connection. Click on YES
Now Remmina will ask for the password:
Finally, connection established, toggle fullscreen and you are ready to go!
Shutdown Hardware Button
You can also add a Power On / Off button to your Raspberry PI using the information from the Raspberry PI Drone post
Show Desktop’s Background instead of Black Screen
By changing "quality" property in the windows.remmina file from 0 to 9 your backround will be visible
Full Screen connection
By changing "viewmode" property in the windows.remmina file from 1 to 4 the connection will start in full screen.