Running xrdp (and sesman) as one (non-root) user and logging in as another #2189
-
Hi there, |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 8 replies
-
If you're running the user sessions entirely in your container, this should be possible (I think). To start a process as another user, sesman needs to be running as root. Presumably it is in the container(?), and also as user 'kalei' on the host. First thing to do would be to get up a root shell in the container and check it can switch to goofy using su or sudo,or whatever. |
Beta Was this translation helpful? Give feedback.
-
sesman creates a new session by forking and changing its uid and gid to the target user's uid and gid. To do this, it needs to be root in the environment it finds itself in. If you're in a container, it should be possible for sesman to be root in that container and to be "kalei" on the host. |
Beta Was this translation helpful? Give feedback.
Thanks to your input @matt335672 I think I got it to work!!
For anyone who might be interested:
Adding this to the Dockerfile
RUN setcap cap_kill,cap_setuid,cap_setgid+ep /usr/sbin/xrdp-sesman
enables the xrdp-sesman process to change UID, GID and kill other processes regardless of the user launching it. I'm not sure if this makes the container less secure than what it would be with xrdp-sesman running as root, but every feedback is more than welcome. Thanks again for your valuable pointer @matt335672, I couldn't have done it without it.