:: Re: [DNG] libpam-xdg-support / libp…
Góra strony
Delete this message
Reply to this message
Autor: Roger Leigh
Data:  
Dla: dng
Temat: Re: [DNG] libpam-xdg-support / libpam-systemd
On 11/09/2015 02:33, Daniel Reurich wrote:
> On 10/09/15 23:46, Roger Leigh wrote:
>> On 10/09/2015 12:11, tilt! wrote:
>>>
>>> Since i already use $HOME/.config for configuration data,
>>> which more precisely is the default setting of XDG_CONFIG_HOME
>>> (according to [1]), i would like to consider the pendant
>>> XDG_RUNTIME_DIR for the tempfile i have described.
>>>
>>> Unfortunately, the specification [1] does not provide a default
>>> for XDG_RUNTIME_DIR as it does for XDG_CONFIG_HOME.
>>>
>>> In Ubuntu, there used to be libpam-xdg-support (see [2]). It
>>> sets up a directory in "/run/user", if neccessary, at login
>>> time of the user. More recently, this task has been assumed by
>>> pam-systemd (see [3]).
>>>
>>> Question open for debate:
>>>
>>> On a systemd-free system, should an alternative exist which
>>> assumes the task of initializing XDG envvars as described by
>>> [1] in the way done by [3]?
>>
>> This part of the XDG specification is pretty terrible. It's poorly
>> specified, and the behaviour as specified is only implementable by
>> systemd (i.e. its lifetime by refcounting all the logins/logouts). It
>> also precludes having more than one session per user. By design... It
>> wouldn't have required much effort to make this more flexible, but the
>> authors of this "specification" don't generally bother with
>> forward-looking flexible design.
>
> We could either use $USER_$SESSIONID or $USER/$SESSIONID to implement
> multiple sessions per user.


This is definitely possible. It would probably need some thought on how
to determine which "session" you are in when cleaning them up via PAM or
whatever. Especially since it's not tied to the PAM session.

>> There's no technical reason for /run/$user to live under /run. It could
>> be just as easily live under /tmp (or /var/tmp). So you could default
>> it to use /tmp/$user or /tmp/xdg-runtime/$user or whatever and make this
>> the default.
>>
> Why not /var/run/xdg-runtime/$USER - it's a better place and more likely
> to have quota's enabled then /tmp


If it's in /var/run it's in /run by default since /var/run is just a
symlink to /run.

If you meant /var/tmp, this won't be cleaned on reboot, while /tmp will
be. Given the emphemeral nature of the user session data, /tmp is
therefore preferable to /var/tmp.

>> So my recommendation here would be to
>> - place /run/user in a subdirectory of /tmp
>> - configure XDG_RUNTIME_DIR to use this location either in a PAM module,
>> or even by hardcoding the default to use this location--the
>> specification might not provide this default, but an implementation
>> certainly can.
>
> indeed, although I'd argue that /var/run/<something>/$USER or possibly
> /var/lib/xdg_runtime/$USER would be better then anything in /tmp.


I think the expected lifetime of the data would make these locations
sub-optimal, as mentioned above.


Regards,
Roger