Xrdp: Bootstrap xrdp on startup for future connections

Created on 8 Mar 2019  路  7Comments  路  Source: neutrinolabs/xrdp

Is it possible to "bootstrap" xrdp on a headless server for accepting future connections?

Using Ubuntu Server 18.04, I install xrdp, xorgxrdp, and xfce or mate and then create an image out of the result. When booting the image on a fresh server, I'd like to have RDP connectivity as fast as possible. The first RDP connection takes up to 20 seconds to initialize (and has 5-10 seconds where the screen is completely black), but subsequent connections are much faster (they reuse the same xorg display and xfce/mate session).

Is it possible to get an xrdp session started when the machine boots up so that when I RDP into it, the xorg display and mate session are ready and initialized?


what I tried:

running xrdp-sesrun 127.0.0.1 ubuntu ...

I get

sesman config:
    ListenAddress:            127.0.0.1
    ListenPort:               3350
    EnableUserWindowManager:  1
    UserWindowManager:        startwm.sh
...
ok 1 display 10
The log reference is NULL - log not initialized properly

but ps aux | grep Xorg and ps aux | grep mate shows that Xorg and mate have not started running.

xrdp-sesadmin shows:

$ xrdp-sesadmin -u=ubuntu ...
[20190307-20:51:41] [DEBUG] libscp initialized
[20190307-20:51:41] [INFO ] [v1c_mng:405] connection ok
Session ID: 1704
    Session type: 2
    Screen size: 1024x768, color depth 24
    Idle time: 0 day(s) 0 hour(s) 0 minute(s)
    Connected: 2019/03/07 20:51
[20190307-20:51:41] [DEBUG] Closed socket 4 (AF_INET6 ::1 port 52586)

then when I connect via RDP it shows

$ xrdp-sesadmin -u=ubuntu ...
[20190307-20:54:10] [DEBUG] libscp initialized
[20190307-20:54:10] [INFO ] [v1c_mng:405] connection ok
Session ID: 1744
    Session type: 3
    Screen size: 1248x1209, color depth 24
    Idle time: 0 day(s) 0 hour(s) 0 minute(s)
    Connected: 2019/03/07 20:54
[20190307-20:54:10] [DEBUG] Closed socket 4 (AF_INET6 ::1 port 52600)

it seems the old session (id 1704) is replaced by 1744. However it clearly still has to start Xorg and mate and that takes time.

I thought running freerdp as a client against localhost could force xrdp to make a session, but unfortunately xfreerdp is an x program and requires a display.

Thanks in advance for any help.

Most helpful comment

+1 from me and I also explored this route. I need this functionality because I want to enforce a single session, always. Seems like sesrun is broken or the manual for usage is insufficient. I had some success creating an Xvnc session at boot and XRDP can connect to it using the port # but pasting from outside does not work.

I guess the succinct question is: how to create an xrdp session via command line?

All 7 comments

I guess this is somewhat similar to #960 , but I don't need to connect to a foreign pre-existing session. I'd be happy to connect to an xrdp-native session, I just need to know how to get xrdp to create such a session on boot.

Any help here?

@proski I believe you wrote the xrdp-sesadmin tool which I tried to use, do you know if it should be possible to use it to do what I described?

I didn't write xrdp-sesadmin, you can see that my changes were superficial and did not affect the code functionality.
https://github.com/neutrinolabs/xrdp/commits/devel/sesman/tools/sesadmin.c

My mistake, I just saw that you had the last N commits. Any chance you can point me to the right person to talk to for this question (or sesadmin functionality)?

It is potentially possible, but need to brush up xrdp-sesrun.

+1 from me and I also explored this route. I need this functionality because I want to enforce a single session, always. Seems like sesrun is broken or the manual for usage is insufficient. I had some success creating an Xvnc session at boot and XRDP can connect to it using the port # but pasting from outside does not work.

I guess the succinct question is: how to create an xrdp session via command line?

I can't help but echo that I'm trying to do exactly this same thing ("initialize" an XRDP session so that it's up and waiting) and running into the same issues. Looking for solutions along this line, something command-line based that I can use to connect and get the ball rolling, so to speak. I was also looking into the rdpy python rdp client, but was hoping for something a little lighter.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sblack1969 picture sblack1969  路  7Comments

faya9551 picture faya9551  路  9Comments

donkey picture donkey  路  6Comments

MoonMoon1919 picture MoonMoon1919  路  5Comments

Jerry-kiwi picture Jerry-kiwi  路  4Comments