-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
pam_systemd(su:session): Cannot create session: Already occupied by a session #7451
Comments
Sorry, but "su" is a tool for changing user identities and very few other process credentials temporarily. It's not a tool for opening a completely new login session. A new login session has a very well defined, pristine setup, not inheriting anything from any other session, but this is really not the case for "su" uid changes: most of the execution environment is inherited over, in numerous and non-obvious ways, for example MAC contexts, audit contexts, cgroup contexts, namespace contexts, scheduling, timer granularity, … if you want a full new session, use something like "machinectl login" or "machinectl shell", which will actually get your a fully clean, independent, detach environment, with no hidden process properties leaking from where you call it into it. logind sessions are mostly bound to the audit session concept, and audit sessions remain unaffected by "su", in fact they are defined to be "sealed off", i.e. in a way that if a process entered a session once, it will always stay with it, and so will its children, i.e. the only way to get a new session is by forking off something off PID 1 (or something similar) that never has been part of a session. Or to say this differently: the stuff you invoke through "su" will show up just fine in "loginctl", however, it remains part of your original session, you logged in originally. You can verify that by invoking "loginctl status" on the original session's ID (which you can see through |
Thank you @poettering! |
@poettering I noticed something strange. The concept behind this was that something part of a session can never create its own, that is as you pointed out, something out of the session (be it PID 1 or something else) must fork it off to create a new session. However, consider this. delta ~ $ loginctl 2 sessions listed. 2 sessions listed. 3 sessions listed. The pid of su turns out to be 2530, and then doing a I am still not sure why this is not working as intended, it was a child of the process in c2, but it instead created a new session the second time I logged in with su, and since this is a new session, I am sure it inherits no properties from the last one, since it lies now in its own scope unit. c3 - kowalski (1000) Jan 06 18:18:27 delta systemd[1]: Started Session c3 of user kowalski. |
and after recursively logging in from c3 using su -l kowalski, it no longer creates a new session on the second invocation as it did in c2. I login from gdm, a new session is created, I su -l kowalski, no new session, I su -l kowalski again from that su, it creates a new session. |
@poettering doing a |
http://dpaste.com/1ZZ39KE.txt relevant paste |
@poettering Ping! Can this be reopened, it appears things are not working the way they should? The title should probably be changed if that happens to be the case. |
Hmm, what you are describing now appears to be a different issue though, no? i.e. that for some reason logind doesn't properly recognize that your client already is inside a session. Please file a new issue about that. |
@poettering |
@ROBERT-MCDOWELL Apparently you can just do run Edit: This seems to be equivalent to |
yeah true, but I'm still trying to create a session for each exec run from a web server side like php |
Submission type
systemd version the issue has been seen with
systemd 235
Used distribution
Exherbo Linux
In case of bug report: Expected behaviour you didn't see
Session created by
su -
gets registered correctly under logind and is visible in loginctl's output, as it does for other users when usingsu - waldo
In case of bug report: Unexpected behaviour you saw
pam_systemd(su:session): Cannot create session: Already occupied by a session
Session is not registered under logind and is not visible in loginctl's output
In case of bug report: Steps to reproduce the problem
su -
The text was updated successfully, but these errors were encountered: