XDG_RUNTIME_DIR: When is a user logged out?

Lennart Poettering mzkqt at 0pointer.de
Thu May 10 13:42:43 UTC 2018


On Do, 10.05.18 09:38, Thomas Kluyver (thomas at kluyver.me.uk) wrote:

> The basedir spec says of XDG_RUNTIME_DIR:
> 
> > ...if the user fully logs out the directory MUST be removed.
> 
> What counts as logging out? For some application code, I assumed that if the application was running as user X, that meant user X was still logged in, and the application could rely on XDG_RUNTIME_DIR continuing to exist. However, some users have reported that if they run a process in nohup/screen and then disconnect, their XDG_RUNTIME_DIR is deleted because they have logged out. It looks like other people have had similar issues:
> 
> 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


More information about the xdg mailing list