Discussion:
XDG_RUNTIME_DIR: When is a user logged out?
Lennart Poettering
2018-05-10 13:42:43 UTC
Permalink
...if the user fully logs out the directory MUST be removed.
https://github.com/projectatomic/libpod/issues/659
https://unix.stackexchange.com/questions/386504/how-do-you-keep-systemd-user-services-alive-over-mosh
I tested this on a Debian system and I couldn't reproduce the problem: XDG_RUNTIME_DIR continued to exist when I disconnected and left a script running in nohup. But I don't know what to tell users who are experiencing this issue.
1. When should the user count as logged out? Is my assumption that
the user is logged in while any process is running with their UID
reasonable? Can we clarify this in the spec?
I wrote the part of the spec initially, but I left this intentionally
vague, to give impementors a bit of freedom to define their session
lifetimes.

That said, on systemd systems the definition of "being logged in" is
generally bound to "there's at least one PAM session around" for the
user. And that is usually bound to "is there an utmp entry for the
user"...

And by that definition just having a process with the user's UID
around is *not* sufficient to keep the XDG_RUNTIME_DIR around.

Lennart
--
Lennart Poettering, Red Hat
Thomas Kluyver
2018-05-10 14:27:43 UTC
Permalink
Thanks Lennart. Would it make sense for our application code to open a Pam session in this scenario so it counts as a login? Sorry if this is a silly question: I know ~nothing about how logins work.

Thomas
Post by Lennart Poettering
...if the user fully logs out the directory MUST be removed.
https://github.com/projectatomic/libpod/issues/659
https://unix.stackexchange.com/questions/386504/how-do-you-keep-systemd-user-services-alive-over-mosh
I tested this on a Debian system and I couldn't reproduce the problem: XDG_RUNTIME_DIR continued to exist when I disconnected and left a script running in nohup. But I don't know what to tell users who are experiencing this issue.
1. When should the user count as logged out? Is my assumption that
the user is logged in while any process is running with their UID
reasonable? Can we clarify this in the spec?
I wrote the part of the spec initially, but I left this intentionally
vague, to give impementors a bit of freedom to define their session
lifetimes.
That said, on systemd systems the definition of "being logged in" is
generally bound to "there's at least one PAM session around" for the
user. And that is usually bound to "is there an utmp entry for the
user"...
And by that definition just having a process with the user's UID
around is *not* sufficient to keep the XDG_RUNTIME_DIR around.
Lennart
--
Lennart Poettering, Red Hat
Thomas Kluyver
2018-05-11 07:48:08 UTC
Permalink
Is there something else we can do to ask the system to keep XDG_RUNTIME_DIR around? Or should any application which might be run in nohup/screen just not rely on XDG_RUNTIME_DIR?

Thomas
Post by Thomas Kluyver
Thanks Lennart. Would it make sense for our application code to open
a Pam session in this scenario so it counts as a login? Sorry if
this is a silly question: I know ~nothing about how logins work.
PAM sessions are generally something only privileged code can
register, hence, no not really...
Lennart
--
Lennart Poettering, Red Hat
Loading...