I have a Linux laptop system set up to connect to a remote file system on a dedicated host. I'm using sshfs at the moment.

When I suspend the laptop or connect to a different network, the ssh connection is disrupted, as would be expected. I have a watchdog script that remounts the mount point when that happens, giving the appearance of a somewhat reliable connection.

However, the remount invalidates handles and produces various errors as a consequence of pulling the rug out from under applications keeping open files; e.g. bash gives a "transport endpoint is not connected" error, vim has problems erasing its swap file, and so on.

So my question is this: is there a better way of keeping a file system connected or appearing to be connected through suspends/hibernates and network changes? The dedicated computer can be assumed to be static, and the solution doesn't have to be limited to the file system level - e.g. if setting up a VPN can fix it by hiding the IP changes from sshfs, that's perfectly in scope.

What I've tried: mucking about with ServerAliveInterval and ServerAliveCountMax - these just change a hang into a force unmount, thus letting my watchdog script work, but they don't solve the problem by themselves.

  • 3
    A VPN solution could help avoid the IP address changes that break your connection Commented Aug 1, 2023 at 19:01


You must log in to answer this question.

Browse other questions tagged .