Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bootstrap xrdp on startup for future connections #1303

Closed
ldub opened this issue Mar 8, 2019 · 7 comments · Fixed by #2472
Closed

Bootstrap xrdp on startup for future connections #1303

ldub opened this issue Mar 8, 2019 · 7 comments · Fixed by #2472

Comments

@ldub
Copy link

ldub commented Mar 8, 2019

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.

@ldub
Copy link
Author

ldub commented Mar 8, 2019

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.

@ldub
Copy link
Author

ldub commented Mar 18, 2019

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?

@proski
Copy link
Contributor

proski commented Mar 19, 2019

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

@ldub
Copy link
Author

ldub commented Mar 19, 2019

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)?

@metalefty
Copy link
Member

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

@GoldenMouse
Copy link

GoldenMouse commented May 23, 2019

+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?

@bdodds
Copy link

bdodds commented May 22, 2020

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.

@matt335672 matt335672 linked a pull request Dec 30, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants