RFE: machinectl to provide starting new session on local machine #825
Well, there have been long discussions about this, but the problem is that what "su" is supposed to do is very unclear. On one hand it's supposed to open a new session and change a number of execution context parameters (uid, gid, env, ...), and on the other it's supposed to inherit a lot concepts from the originating session (tty, cgroup, audit, ...). Since this is so weakly defined it's a really weird mix&match of old and new paramters. To keep this somewhat managable we decided to only switch the absolute minimum over, and that excludes XDG_RUNTIME_DIR, specifically because XDG_RUNTIME_DIR is actually bound to the session/audit runtime and those we do not transition. Instead we simply unset it.
Long story short: "su" is really a broken concept. It will given you kind of a shell, and it's fine to use it for that, but it's not a full login, and shouldn't be mistaken for one.
THis has come up many times, but nothing really changed, hence closing this now. I understand this is confusing and unexpected, but well, that's UNIX...
@poettering thanks for answer. how it supposed to be in the future? How I should do full login without creating new ssh session?
Well, you can use su and sudo as before, but don#t expect that it will work in full, because it never did.
I am not aware of a commonly used tool besides ssh that would give you a completely fresh login locally without inheriting anything. I figure "machinectl login" could be updated to do that though...
@poettering so, can we reopen this bug with new title (feature request for machinectl)?
Sure. Here we go.
BTW, thinking about that, we might even want to add a new "machinectl shell" or so, which is like "machinectl login" but gives you a shell right away, and sets PAMName=login so that we get a full login session...
machinectl shell
like "machinectl login" but gives you a shell right away, and sets PAMName=login so that we get a full login session...
sounds very good!
Let me know if I can help (probably with testing or so)!
ssh root@+echo $XDG_RUNTIME_DIR-->/run/user/0ssh user@+su - root+echo $XDG_RUNTIME_DIR--> nothingSomething interesting from logs.
Now I'm using kdbus.