F31 - mounting sshfs with autofs

So, I can mount sshfs shares using the traditional fstab mechanism. But to keep the mount mechanism lightweight (on demand, unmount on idle) I decided to try out autofs but not getting any joy.

Can anyone spot anything wrong here? Or suggest anything to try further?

So here’s how I went about setting it up:

create mount point

mkdir /sshfs

Create file /etc/auto.master.d/sshfs.autofs

/sshfs      /etc/auto.master.d/auto.sshfs      --timeout=30

Create /etc/auto.master.d/auto.sshfs

dns315    -fstype=fuse,idmap=user,rw,allow_other,noatime,IdentityFile=/home/jetstream/.ssh/id_rsa :sshfs\#jetstream@local.dns315\:/remote/server/path

I tested that root can ssh into the account using the Identityfile using the command line.

Also, it is possible to mount the remote filesystem from the command line, but not through autofs.

I was expecting /sshfs/dns315 to show up after a successful autofs mounting operation.

Output from automount -f -d

master_do_mount: mounting /sshfs
automount_path_to_fifo: fifo name /run/autofs.fifo-sshfs
lookup_nss_read_map: reading map file /etc/auto.master.d/auto.sshfs
do_init: parse(sun): init gathered global options: (null)
mounted indirect on /sshfs with timeout 30, freq 8 seconds
st_ready: st_ready(): state = 0 path /sshfs
st_expire: state 1 path /sshfs
expire_proc: exp_proc = 139918710867712 path /sshfs
expire_cleanup: got thid 139918710867712 path /sshfs stat 0
expire_cleanup: sigchld: exp 139918710867712 finished, switching from 2 to 1
st_ready: st_ready(): state = 2 path /sshfs
st_expire: state 1 path /sshfs
expire_proc: exp_proc = 139918710867712 path /sshfs
expire_cleanup: got thid 139918710867712 path /sshfs stat 0
expire_cleanup: sigchld: exp 139918710867712 finished, switching from 2 to 1
st_ready: st_ready(): state = 2 path /sshfs
st_expire: state 1 path /sshfs
expire_proc: exp_proc = 139918710867712 path /sshfs
expire_cleanup: got thid 139918710867712 path /sshfs stat 0
expire_cleanup: sigchld: exp 139918710867712 finished, switching from 2 to 1
st_ready: st_ready(): state = 2 path /sshfs
do_notify_state: signal 2
master_notify_state_change: sig 2 switching /misc from 1 to 5
master_notify_state_change: sig 2 switching /net from 1 to 5
master_notify_state_change: sig 2 switching /sshfs from 1 to 5
1 Like

Did you consider using SFTP with GIO/GVFS?

nautilus sftp://user@host/path

Thanks @vgaetera . Yes, that option (static mount) works. What you mention is the Nautilus equivalent of what I meant when I said I am able to mount it from the command line.

Like, so (from the terminal)

sshfs -o idmap=user local.dns315:/remote/server/path /local/mount/path

But that would keep the remote share mounted till I unmounted it.

With autofs, I am trying to have it auto mounted on demand (when accessed) and then auto unmounted (when idle for more than the timeout specified).

1 Like