Remote Desktop Protocol (RDP) with Ubuntu and XRDP

xrdp – an open-source Remote Desktop Protocol server
github.com/neutrinolabs/xrdp
Xrdp

Tutorials

Using Windows RDP to Access your Ubuntu Instance
How to use xRDP for remote access to Ubuntu 14.04
Ubuntu 14.04 – How to install xrdp in Ubuntu 14.04

XRDP – Quick fix – Custom XRDP install on Ubuntu 15.04 using systemd

$ sudo apt-get install ubuntu-desktop 
$ sudo apt-get install xrdp
$ sudo /etc/init.d/xrdp start
$ sudo adduser USERNAME
$ service xrdp restart
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to manage system services or units.
Multiple identities can be used for authentication:
 1.  Andreas Bachmann,,, (andreas)
 2.  rdpuser
Choose identity to authenticate as (1-2): Failed to restart xrdp.service: Connection timed out

$ sudo service xrdp restart
A dependency job for xrdp.service failed. See 'journalctl -xe' for details.

# /etc/init.d/xrdp start
[....] Starting xrdp (via systemctl): xrdp.serviceA dependency job for xrdp.service failed. See 'journalctl -xe' for details.
 failed!

# systemctl enable xrdp-sesman.service
Created symlink from /etc/systemd/system/multi-user.target.wants/xrdp-sesman.service to /lib/systemd/system/xrdp-sesman.service.

# systemctl enable xrdp.service
Synchronizing state for xrdp.service with sysvinit using update-rc.d...
Executing /usr/sbin/update-rc.d xrdp defaults
Executing /usr/sbin/update-rc.d xrdp enable
# cat /lib/systemd/system/xrdp.service
[Unit]
Description=xrdp daemon
Requires=xrdp-sesman.service
After=syslog.target network.target xrdp-sesman.service

[Service]
Type=forking
PIDFile=/var/run/xrdp.pid
EnvironmentFile=/etc/sysconfig/xrdp
ExecStart=/usr/sbin/xrdp $XRDP_OPTIONS
ExecStop=/usr/sbin/xrdp $XRDP_OPTIONS --kill

[Install]
WantedBy=multi-user.target
# cat /lib/systemd/system/xrdp-sesman.service
[Unit]
Description=xrdp session manager
After=syslog.target network.target
StopWhenUnneeded=true

[Service]
Type=forking
PIDFile=/var/run/xrdp-sesman.pid
EnvironmentFile=/etc/sysconfig/xrdp
ExecStart=/usr/sbin/xrdp-sesman $SESMAN_OPTIONS
ExecStop=/usr/sbin/xrdp-sesman $SESMAN_OPTIONS --kill

[Install]
WantedBy=multi-user.target
### Change in /lib/systemd/system/xrdp.service and /lib/systemd/system/xrdp-sesman.service:
### /etc/sysconfig/xrdp -> /etc/default/xrdp

# service xrdp start
Warning: xrdp.service changed on disk. Run 'systemctl daemon-reload' to reload units.
A dependency job for xrdp.service failed. See 'journalctl -xe' for details.

# systemctl daemon-reload

# service xrdp start
--> Hangs?!

# /usr/sbin/xrdp
# /usr/sbin/xrdp-sesman
--> Works!

# /usr/sbin/xrdp
running in daemon mode with no access to pid files, quitting

# sudo mkdir /var/run/xrdp
# sudo chown xrdp:xrdp /var/run/xrdp

Leave a Reply

Your email address will not be published. Required fields are marked *