Systemd automount sshfs sftp?

I am trying to setup systemd to automount a sshfs for me.
Using the following guide: SSHFS - ArchWiki

It all seems to be fine, except when i open the folder that’s supposed to have the mount, it just disappears.

Has anyone got this working?

my automount:

    [Unit]
    Description=network mount
    Requires=network-online.target
    After=network-online.service

    [Automount]
    Where=/home/bronson/test3
    TimeoutIdleSec=60

    [Install]
    WantedBy=multi-user.target

my mount

    [Unit]
    Description=network mount
    Requires=network-online.target
    After=network-online.service
    Wants=network-online.target
    Before=remote-fs.target

    [Mount]
    What=s@living.lan:/home/s/Bible
    Where=/home/bronson/test3
    Type=fuse.sshfs
    Options=_netdev,rw,nosuid,allow_other,uid=1000,gid=1000,default_permissions,follow_symlinks,idmap=user,identityfile=/home/bronson/.ssh/id_ed25519
    TimeoutSec=2
    #ForceUnmount=true

    [Install]
    WantedBy=remote-fs.target
    WantedBy=multi-user.target

Remove the unit dependencies - they are all implied by the _netdev mount option. Adding them may interfere with operation.

[Unit]
Description=network mount
#    Requires=network-online.target
#    After=network-online.service
#    Wants=network-online.target
#    Before=remote-fs.target

[Mount]
What=s@living.lan:/home/s/Bible
Where=/home/bronson/test3
Type=fuse.sshfs
Options=_netdev,rw,nosuid,allow_other,uid=1000,gid=1000,default_permissions,follow_symlinks,idmap=user,identityfile=/home/bronson/.ssh/id_ed25519
TimeoutSec=2
#ForceUnmount=true

[Install]
WantedBy=remote-fs.target
WantedBy=multi-user.target

Be sure to ONLY enable the automount unit

You have a 2s timeout for mount - that is too short - it is a network location - give it more time to mount.

Thanks. Ive made the changes, and still having the same issue.

Have you tried mounting on commandline?

sshfs s@living.lan:/home/s/Bible /home/bronson/test3 -o _netdev,rw,nosuid,allow_other,uid=1000,gid=1000,default_permissions,follow_symlinks,idmap=user,identityfile=/home/bronson/.ssh/id_ed25519

What are the message displayed if any?

ok thats a good idea! I get the following error:

fusermount3: option allow_other only allowed if 'user_allow_other' is set in /etc/fuse.conf

so i run as sudo:

The authenticity of host 'living.lan (192.168.1.2)' can't be established.
ED25519 key fingerprint is SHA256:....
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes

ive accepted the key, now ill retry if the mount works

that is also a suggestion on how to address that error - is that option set in /etc/fuse.conf ?
Set it if it is not.

ok so the automount reports the following error:

home-bronson-test.automount: Failed with result 'mount-start-limit-hit'.

and the mount

Nov 23 21:33:07 blaptop systemd[1]: Mounting network mount...
Nov 23 21:33:07 blaptop mount[2135]: read: Connection reset by peer
Nov 23 21:33:07 blaptop systemd[1]: home-bronson-test.mount: Mount process exited, code=exited, status=1/FAILURE
Nov 23 21:33:07 blaptop systemd[1]: home-bronson-test.mount: Failed with result 'exit-code'.
Nov 23 21:33:07 blaptop systemd[1]: Failed to mount network mount.
Nov 23 21:33:08 blaptop systemd[1]: home-bronson-test.mount: Start request repeated too quickly.
Nov 23 21:33:08 blaptop systemd[1]: home-bronson-test.mount: Failed with result 'exit-code'.
Nov 23 21:33:08 blaptop systemd[1]: Failed to mount network mount.

Looks like kde is overloading the automount? Is there a way to work around this?

I think the fusermount issue was more related to not running as root, right? Whe i ran as root and accept the ssl stuff it works fine via command line.

It just the service playing up.

I don’t think so - it’s not what the message implies.
Almost everything can be forced via root …

ok ive modified the fuse.conf so the command works from the terminal without root access fine.

Edit: Ok i have got it working!

my updated units:

    [Unit]
    Description=sshfs network mount
    Before=remote-fs.target

    [Mount]
    What=s@living.lan:/home/s/Bible
    Where=/home/bronson/test
    Type=fuse.sshfs
    Options=_netdev,rw,nosuid,allow_other,uid=1000,gid=1000,default_permissions,follow_symlinks,idmap=user,identityfile=/home/bronson/.ssh/id_ed25519
    TimeoutSec=30

    [Install]
    WantedBy=remote-fs.target
    WantedBy=multi-user.target

and

    [Unit]
    Description=sshfs network mount

    [Automount]
    Where=/home/bronson/test
    TimeoutIdleSec=0

    [Install]
    WantedBy=multi-user.target

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.