My workplace offers Remote Desktop Services (RDS) with all the tools I need to get my job done when I’m away from my laptop (or for when I’m too lazy to get it out of the car). Today I went about setting up a home workstation, looking for an inexpensive way to connect to this compute in the cloud using something I already had around the house. Who doesn’t have a few Raspberry Pi’s kicking around in their drawers? As it turns out a Raspberry Pi 3 running Raspbian Stretch fits the bill nicely, HDMI, wifi, plenty of USB for keyboard, and mouse, etc. I briefly checked out the Raspberry Pi Thin Client project but since I already had a Pi running the latest Stretch image, I figured I’d roll with that.
I checked out a few RDP apps for Linux and settled on freerdp, which is available via aptitude.
sudo apt-get install freerdp-x11
After reading over the documentation and looking at a few examples, I found the right syntax to setup the connection to my work’s RDS server, sitting behind a web gateway. The switches are relatively self explanatory, the last /f is to start the session full screen.
xfreerdp /g:gateway.foo.bar /gu:firstname.lastname@example.org /gp:gatewaypassword /v:rdsserver.foo.bar /u:email@example.com /p:rdspassword /f
I put this command in a script. In the example below you see a “sleep 5” command just before the connection string, more on this later.
I wanted this connection to fire as soon as my Raspberry Pi started up. To do this I added the script to LXDE’s autostart file so it fires after the default pi user logs in.
In my testing I found the Pi would boot so quickly into X that it beat the WiFi connection. So, I added sleep 5 in my connection script to give the Pi 5 seconds to “settle down” and connect to WiFi before attempting the RDS connection.
Voila, on boot and after the pi user logs in, my connectts.sh script fires which connects me right into my RDS server!