[systemd-devel] Automount some dirs at user ligin

Lennart Poettering lennart at poettering.net
Fri May 20 13:54:54 UTC 2016


On Wed, 18.05.16 22:14, Vasiliy Tolstov (v.tolstov at selfip.ru) wrote:

> I need to mount tmpfs on .cache for each user after login.
> How can I do that with systemd?
> S
> For example I want for user1 mount tmpfs on dir .cache, for user2 mount
> .cache to tmpfs also and so on.
> After logout last session for this user, I need to unmount it...

systemd does not cover this, and I am not sure it should. There's a
reason why .cache is defined to be in $HOME and not in /tmp or /run after all...

If you want to redefine .cache like this, then I'd probably just add a
few system-wide shell profile lines that symlink .cache into
$XDG_RUNTIME_DIR/cache or so. After all that is a tmpfs whose lifetime
is bound to the user being logged in, and it has a per-user size limit applied.

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list