Similar to TeamViewer a remote desktop connection enables remote access to another computer. This has the advantage that you don’t need two monitors or have to switch between two systems.
Although the Raspberry Pi can be controlled almost exclusively via console, but some programs are to be controlled only by a GUI. On all Windows systems a program for remote access is already installed and therefore it requires no additional software. And even on Mac OS or other Linux distributions it is very easy to connect to the Pi.
The alternative would be a VNC or TeamViewer connection. But the disadvantage of VNC and TeamViewer is the higher transfer rate. So if you want to remote control your Raspberry Pi over a mobile data connection, the Remote Desktop Connection provides a traffic sparing connection. On Windows systems the tool for the connection is already installed.
Installing the Remote Desktop Server
First open the Raspberry Pi terminal by using mouse and keyboard or by connecting via SSH.
On the Pi you basically just need to install one package:
sudo apt-get install xrdp
The most important and recommended settings are already defined. You can login immediately. On a Windows PC search for “Remote Desktop Connection“. For Mac OS, there is an app from Microsoft and for Linux there is “rdesktop“.
By clicking the Options button you can personalize some settings, like resolution or keyboard/audio settings.
Now you have to enter the host name, which can be the IP of the Raspberry Pi (or the DNS server if you are not in the local network) or the name of Pi’s (default: raspberrypi) if your PC in the same network as the Pi. The login screen will appear.
If you are not sure which IP address your Raspberry Pi has you can find it in your router’s menu (by opening 192.168.0.1 or 192.168.1.1). The internal IP of your Pi is probably also in this format: 192.168.x.xxx
Here, you are just entering your login information (the same as for SSH, the default username is pi and the default password is raspberry), then you should see the desktop.
If you want to have access also outside from of a network (via console and/or remote) you should install a DNS service on the Pi.
Should you not be able to log in despite correct login data because an error message “error – problem connecting” occurs, this is most likely due to an incompatible VNC version that is installed. To fix this error, just a few commands need to be run. To do this, close the remote desktop window and switch back to the terminal (or in Putty):
sudo apt-get remove xrdp vnc4server tightvncserver --yes sudo apt-get install tightvncserver --yes sudo apt-get install xrdp --yes
First we uninstall xrdp and the wrong VNC version. The correct one (TightVNCServer) is then installed, whereupon XRDP is also installed again.
If the problem persists and you get a timeout with the user pi, you can do the following: Call up the system configuration:
Under System Options -> Boot choose an option without autologin. Then restart. This is due to the fact that a user can only work on the desktop in one session at the same time and by default the user pi is logged in directly.