[systemd-devel] Mount a remote FS as a user

Daniel Tihelka dtihelka at gmail.com
Mon Feb 11 14:59:09 UTC 2019


Hello,
I can mount a shared file system (sshfs in particular) as an ordinary user.

Now I would like to have it handled by systemd on-demand (automount).
However, creating the automount unit and starting it fails with error:

~ $ systemctl --user status run-mount-dt-ARTIC.automount
● run-mount-dt-ARTIC.automount - Automatic mount the shared folder
   Loaded: loaded
(/home/dt/.config/systemd/user/run-mount-dt-ARTIC.automount; enabled;
vendor preset: enabled)
   Active: failed (Result: resources)
    Where: /run/mount/dt/ARTIC

I have an access to the required mount point:

~ $ touch /run/mount/dt/ARTIC/XXX
~ $ echo $?
0
~ $ rm /run/mount/dt/ARTIC/XXX
~ $ echo $?
0

and also invoking sshfs directly works without problems (it uses key
stored in the ssh-agent).

The unit looks as follows:

~ $ cat ~/.config/systemd/user/run-mount-dt-ARTIC.automount
[Unit]
Description=Automatic mount the shared folder

[Automount]
Where=/run/mount/dt/ARTIC
DirectoryMode=0700
TimeoutIdleSec=6000

[Install]
WantedBy=default.target


~ $ cat ~/.config/systemd/user/run-mount-dt-ARTIC.mount
[Unit]
Description=Mounts the shared folder

[Mount]
What=pole:/data-ntis/projects/ARTIC/
Type=fuse.sshfs
TimeoutSec=6000

systemd 239
+PAM +AUDIT -SELINUX -IMA -APPARMOR +SMACK -SYSVINIT +UTMP
+LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS
+KMOD +IDN2 -IDN +PCRE2 default-hierarchy=hybrid


Is there something I am doing wrong, or is it the user-instance of
systemd which is unable to mount the path? Unfortunately, I don't have
root access to put it into the /etc/fstab, but I would suppose it
should work anyway when I am able to run it manually.


Thank you
DT


P.S. The different (but somehow similar) story is the mount of cifs
share. It requires the root access, but I can't see a security issue
of mounting a remote FS when I can authenticate myself ...


More information about the systemd-devel mailing list