xrdp fails if Xsession not /bin/sh script

Bug #1693518 reported by Norman Wilson
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
xrdp (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

In Ubuntu 14.04; package xrdp, version 0.6.0-1:

If /etc/X11/Xsession is not a /bin/sh script, xrdp sessions may not start.

The trouble is that /etc/xrdp/startwm.sh begins with

#!/bin/sh

and executes Xsession with

. /etc/X11/Xsession

If Xsession contains anything that is not a valid /bin/sh command, an error may result; depending on the error, Xsession may misbehave (leaving an improperly-set-up session) or just exit (abruptly terminating the session).

Live example: we have a heavily-localised Xsession file. It is a bash script; its first line is
#!/bin/bash

It contains some commands that are valid bash but not valid /bin/sh (== dash). They are sufficiently invalid that Xsession exits. Hence no one can make a useful session via RDP.

The same Xsession file has worked for years with kdm, so it is not a general assumption that Xsession is a /bin/sh script; in fact I think the general X11 rule is that it's just some sort of executable.

A simple fix is to replace the offending line in startwm.sh with

exec /etc/X11/Xsession

(Or just /etc/X11/Xsession without the exec, but it's the last line of the file, so there's no reason to keep the extra process hanging around.) This lets the kernel decide what to do about Xsession, #!/bin/bash tells it what to do, and everything works.

Thanks!

Revision history for this message
Norman Wilson (norma7) wrote :

Some additional clues:

1. The offending file in the source package, as fetched by apt-get source xrdp, is
xrdp-0.6.0/debian/startwm.sh

2. I have ordinary-user access to an Ubuntu 16.04 system. apt-get source xrdp there confirms that the corresponding file
xrdp-0.6.1/debian/startwm.sh
is the same. So the same bug exists in Ubuntu 16.04, in xrdp 0.6.1.

3. In both cases it looks like the bug is imported from Debian.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in xrdp (Ubuntu):
status: New → Confirmed
Lenin (gagarin)
Changed in xrdp (Ubuntu):
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.