Remote Access to Raspberry Pi
I guess setting up Raspberry Pi in headless mode is probably the most common and certainly the most convenient way of using this awesome device. There are obviously several ways to achieve the same thing. This post describes at least some.
This article describes the way how to connect to your Pi from a PC or remote machine, via the network. It is of course important that your Pi is ready for such connections: typically you need to install some software and/or enable SSH on the Pi itself (in raspi-config).
xrdp
xrdp is an open source remote desktop protocol (RDP) server. The solution is ideal and well made: first time users or Windows-only users will also appreciate xrdp works great with 'Remote Desktop Connection' (RDP) client in windows. Of course you have to be aware this is for solutions where you use the Raspberry Pi desktop.
To install simply use the below (obviously it is good manners to update first)
sudo apt install xrdp
Note: Recently, starting with Jessie, xrdp can fail on some configurations / desktops. Searching the internet, you will typically find guides which require you to purge the VNC server and swap installation sequences: The guides are not wrong of course, but in our opinion workarounds. If your xrdp fails, follow the tip below (otherwise ignore).
To fix xrdp, which is not responding or showing blank screens, install the xorgxrdp package, on top of xrdp. Your installation would look like this:
sudo apt install xrdp
sudo apt install xorgxrdp
This tip works also for other failing distros: Ubuntu Mate and others.
Putty
The ultimate tool for remote access to anything is Putty. It became a de-facto standard recommendation and it certainly is a great tool. We can recommend using a portable version of the software, found here; install it on your USB stick and use anywhere.
Remote Desktop via MobaXterm
There are some other limitations to xrdp. For instance it works rather nice with Debian, but not Ubuntu (due to the Unity desktop). Enter MobaXterm.
MobaXterm is your ultimate toolbox for remote computing. In a single Windows application, it provides loads of functions that are tailored for programmers, webmasters, IT administrators and pretty much all users who need to handle their remote jobs in a more simple fashion.
Ultimately, I now use MobaXterm for SSH access, but also for running windowed applications. On top of all, there is no need to install anything on your Raspberry Pi.
Using MobaXterm for SSH is a no-brainer. Below is a description on how to use windowed applications. For the curious guys out there, this is done by forwarding X11 over an SSH tunnel to MobaXterm's server, and using sftp for file transfer.
- Setup a MobaXterm SSH connection as usual
- Login to the Pi
- Once on the command-line, type the application name followed by '&'
- To run leafpad: 'leafpad&'
- To run the whole desktop: 'lxsession&'
Alternatives to MobaXterm
Having promoted MobaXterm again and again, it is to be said that you can use several different SSH tools (or just connect from the Windows Bash Shell if you have set it up). Here are few worth mentioning:
- SmarTTY - a great alternative. It is a free multi-tabbed SSH client which supports copying files and directories with SCP on-the-fly, editing files in-place, runs graphical applications with built-in Xming and so much more. Free and optionally portable.
- FireSSH: This is a Firefox addon, which might come in useful as an SSH client
Many more are available, both free, open-source, paid, mixed models. Search for a comparison of those tools, for instance here
Notes
- It seems that it is now easier to connect to the Pi using the new MobaXterm 6.1 or above: in the Advanced SSH session settings (step 5), just choose "LXDE desktop" for the "Remote environment" setting (instead of 'interactive shell'): when launching the session, it will show the full Pi desktop in a frame!
- MobaXterm has a free version vs. paid. Now normally I would never use such a program: in this case however I make an exception. The free features are still perfectly great for me
- MobaXterm also has an SSH key generator. Awesome. However, if you run the portable version, you have new keys everytime you launch the app. Some sources recommend an install, but if you wish to stay in portable mode, there is a workaround: make sure you set up the application first by choosing a persistent home directory: Settings -> General -> Persistent Home Directory. This should fix the problem.