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

Is there a way to manage xrdp sessions for multiple users? #820

Open
BloodyIron opened this issue Jul 17, 2017 · 12 comments
Open

Is there a way to manage xrdp sessions for multiple users? #820

BloodyIron opened this issue Jul 17, 2017 · 12 comments

Comments

@BloodyIron
Copy link

I'm wondering if there's a way in xrdp to be able to look at session info for multiple users for xrdp. Things like, kicking users, see who's connected, how many logins currently, etc. Is this possible?

@speidy
Copy link
Member

speidy commented Jul 17, 2017 via email

@BloodyIron
Copy link
Author

It looks like xrdp-sesadmin doesn't have the working functionality to kill sessions. There is a parameter available, but documentation (and testing) shows that it doesn't work.

I'm on 0.9.0 and I don't see anything relevant to this in the release notes for newer versions.

Being able to kill sessions is very important. Are there any plans for this?

@ben-cohen
Copy link
Contributor

This doesn't seem to be implemented: cmndKill() in xrdp/sesman/tools/sesadmin.c is empty.

Presumably it needs to be added to the scp (sesman protocol). On the server side, killing the session xrdp-sesman isn't enough: it needs to kill the X server and/or startwm.sh.

@speidy
Copy link
Member

speidy commented Jul 19, 2017 via email

@BloodyIron
Copy link
Author

How hard do you see this being to implement?

@ben-cohen
Copy link
Contributor

I think this sort of thing is easier with my shared memory change (pull request #819). We could add fields for the Xorg pid (and the wm pid if you like) and the session instance process of xrdp-sesman can set them in session_start_fork(). Then the daemon instance can see those pids to kill them. (Otherwise it will have to walk the processes tree in /proc.)

Btw I think it would be a good idea for each xrdp-sesman session instance (and descendants) to get a new Linux session (SID).

@pieska
Copy link

pieska commented Dec 7, 2017

Today i had the problem to kill a bunch of sessions. After looking at the output of 'ps axjf' i wrote a little tool for that:

#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <signal.h>
void main(int argc, char **argv) {
pid_t pid, pgid;
pid = atoi(argv[1]);
pgid = getpgid(pid);
printf("pid = %i, pgid = %i\n", pid, pgid);
if(kill(-pgid, SIGTERM) == SUCCESS) {
printf("pgid killed\n");
}
};

Basically the idea is to get the process group pid of the sesman process and send TERM to every process in this process group. It seems to work, everything started by sesman including sesman was terminated.

sid could work too, but i'm no expert.

@alexmyczko
Copy link

alexmyczko commented Jan 22, 2024

I would also like to have xrdp-sesman list me all users having a session.

When I am sure I don't have a session and check with xrdp-sesman -u=me -p -c=list it lists me two sessions, but I'm
in no way logged in as that "me" user, invisible with loginctl and who

I have found this useful to check the logs:
zcat $(ls -1d /var/log/xrdp-sesman.log*|sort -Vr) |grep "++"

The used xrdp versions are: xrdp 0.9.21.1-1ubuntu1 and xorgxrdp 1:0.9.19-1ubuntu1

also waiting for #1302

@matt335672
Copy link
Member

It's on the list of improvements I want to make to xrdp-sesadmin. I want to be able to add some users as admin users who will have visibility of all xrdp sessions.

#2745 (which fixes #1302) will be merged as soon as we've got GFX working reliably. That's a main priority for us at the moment.

@alexmyczko
Copy link

alexmyczko commented Feb 11, 2024

i've got some loginctl interface with a xrdpctl, if you're interested?

@matt335672
Copy link
Member

Thanks @alexmyczko

By all means post it - it may well be useful to other users.

@alexmyczko
Copy link

Ok it wasn't written yet, but this works for me. Enjoy!

https://github.com/alexmyczko/autoexec.bat/blob/master/xrdpctl

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

No branches or pull requests

6 participants