You might be an enthusiast or multi desktop user. You will always find yourself logging into multiple desktops for carrying out different tasks.If you are such a kind of person this post will help you to easily setup xrdp and manage remote sessions of multiple desktops/laptops.
In order to remote desktop into your Linux machines you need the following packages/components installed on to your machine.
- Any 2D Desktop environment like LXDE or XFCE
XRDP: xrdp is a remote desktop protocol daemon.Unlike Windows NT/2000/2003/2008/2012 server, xrdp will not display a Windows desktop but an X window desktop to the user.
You can install xrdp by running the following command,
$sudo apt-get install xrdp
On successful installation you can check the status of xrdp services by running the following command,
sudo service xrdp status
You may see the following status if xrdp is running,
2D Desktop Environment: If you are are having Cinnamon/Unity/KDE/Gnome or any other 3D desktop environment you will have issues while establishing remote desktop connection. In order to over come this it is advised to install any 2D desktop environment like XFCE or LMDE etc.
In my case i am about to install xfce, Run the following command to install,
$sudo apt-get update
$sudo apt-get install xfce4
By default the xrdp uses the Desktop environment that is installed along with the distro. To make xrdp use xfce DE that we installed in the above steps you may need to configure the xrdp. To do this run the following command.
$echo xfce4-session >~/.xsession
Restart the xrdp service to refresh the recently made changes.
Testing remote connections:
Now after installing XRDP as menitoned above you may now try to establish a remote session. Run the following command to know the ip of your server machine in which xrdp is installed with the series of steps mentioned above.
Since i am running Linux mint on the client machine too I am using a Remmina as my rdp client. If you are having windows machine as client then you can try the same with Remote Desktop connection app that ships in windows.Enter the Ip of the server machine that you obtained in the above command as mentioned below.
Note: Make sure you select RDP-Remote Desktop Protocol in the Protocol drop down bar
You will get the following window if on successful connection.
In the above screen enter the username and password of the server machine.
That’s it! You have successfully established remote connection.
Note:If you face any connection issue during the above process, make sure both your server and your client are in the same network. Also you need to make sure your firewall doesn’t block the xrdp port. By default xrdp runs on port number 3389. Also in Linux Mint make sure desktop sharing is turned on in Desktop sharing settings.
Reconnecting on the same session:
Till now you may have noticed that whenever you close the session and reconnect it you will be present with a new session rather than the previous session. In order to fix this carry out the following steps,
Locate the xrdp.ini file using the following command,
$sudo nano /etc/xrdp/xrdp.ini
And add the following lines at the end.
Save the file and restart the service using
sudo service xrdp restart
Now establish the first connection (after boot)as it is by just keeping the module in XRDP login page sesman-Xvnc.
Now close the session and again establish RDP connection. This time don’t choose Module=sesman-Xvnc. Expand the drop down to see Module named Reconnect that we created using the above step.
Voila !!!!!! Now you will be presented with the earlier session instead of creating a new session.
NOTE: You may see xrdp session names, username and password and ip and port
By default xrdp uses 5901 port for first session at the time of boot. Every time a new connection is established i.e on the first boot time of connecting through RDP the port remains 5901. If you close this session and open a new connection the port will change.