Tuesday, September 23, 2014

Working remotely on a Raspberry Pi

I've been trying to do some real work on a Raspberry Pi and it's cramped my style a little bit to cannibalize a monitor and slap an extra keyboard an mouse on my desk.

Working in Raspian Wheezy, you have a lot of Debian Linux at your disposal, so I thought, "I'll just ssh in" That works great, from either a Linux VM, or using Putty on Windows. I needed to run graphical applications and spawn terminals at will, so I really wanted full desktop experience.

X11, the base graphic interface run by virtually all Unix-like operating systems, supports a feature known as display redirection. I used this back in the 90's when I tried to make use of a boat anchor DECstation from my Slackware Linux box. It still pretty much works the same way it did 20 years ago. Before I get too far into how it works, I'm just going to stop and and mention that if all you want is to remotely run graphical programs on your Rasberry Pi, stop right there!  There is a much easier way! X11's server-client model is very powerful and flexible, and is unique in a class of technologies that has stood the test of time, but it's not very "get'er done" user friendly.

Linux machines support Microsoft's "Remote Desktop" protocol with two programs: xrdp and rdesktop.

xrdp is the "Remote Server". This runs on the machine that your want to remotely log into. Note that is this backward from X11, where the "server" is the machine with the physical display, and the client is the (remote) application that generates contents to display.

To install xrdp on your Pi (if using Raspian or other Debian Linux derivative), type:

sudo apt-get update

then

sudo apt-get install xrdp

You're pal apt will download, setup, and launch the xrdp deamon to start listing for connection requests. If you're parnoid, reboot your Pi to make sure.




Now, to get the IP address of your Pi, type:

ifconfig

Look for the "inet addr" entries in the output. Use, the entry under "eth0" or "wlan0" if you're using the wired or wireless networking, respectively.

If you are working on Windows to log into your Pi, you can run the "Remote Desktop Connection" application, and enter the IP address of your Pi. (You also might want to select a smaller screen size than the default full screen)

Microsoft publishes a RDP remote desktop client for OSX, called appropriately, "Microsoft Remote Desktop", in the OSX App Store.  I have not used it much, but I can confirm that it does work with the Pi.

If you're running from another Linux machine, or even another Pi, install "rdesktop"(I tested this on Linux Mint, but I think it should work on most Debian based Linux flavors)

sudo apt-get install rdesktop

then to log-in to your Pi by this in a terminal:

rdesktop -g 1280x1024 192.168.1.131&

you can replace the resolution with whatever you want. Replace the IP address with the actual address if your Pi.

ADDENDUM:

From time to time, if you don't have it set with a static address, your Pi may get assigned a new IP address. If logging into your router/dhcp server is not convenient, try the nifty Fing for Win/Mac/Linux/Android/iOS, It can quickly scan a local network for devices.



No comments:

Post a Comment

I welcome you're thoughts. Keep it classy, think of the children.