1

How do I prevent SSHFS from freezing everything that attempts to access it when the server doesn't answer?

My fstab looks like this:

user@domain.com:/home   /mnt/data-remote        fuse.sshfs      defaults,_netdev,port=23,uid=0,gid=0,IdentityFile=/etc/remote/user_domain_ed25519,reconnect,ServerAliveInterval=15,ServerAliveCountMax=3,PasswordAuthentication=no       0 0

Once frozen, everything trying to access it freezes as well, so often enough systemctl reboot doesn't work either and I have to hardware reset a production server.

How do I make sshfs crash or unmount itself if reconnection fails long enough instead of making the entire system unresponsive?

Cobra_Fast
  • 630
  • 2
  • 7
  • 22

1 Answers1

1

It depends on what you are doing on the mount. If you have, say a swap file in use (an extreme example), chances are the whole system is going to be brought down.

So, the first step is to find what is being blocked by the lack of access to the mount and see if that software can be talked into gracefully stopping.

Other than that, you can kill the process doing the actual ssh tunnel. Something along the lines of pkill sshfs.

Find out why sshfs does not longer work might also help. You could try tweaking ClientAliveInterval and ClientAliveCountMax in sshd_config.

Also autofs could also help.

Eduardo Trápani
  • 1,140
  • 6
  • 10