Comment 45 for bug 159031

Revision history for this message
Carnë Draug (carandraug) wrote :

I believe the problem with this is that the connection is reset when there's no traffic which causes sshfs to hang. This is exactly what happens if you leave a ssh terminal open and walk away. Since sshfs simply uses ssh, it will behave the same way. There's many ways to workaound this.

* configure ssh with a ServerAliveInterval value. When there's no traffic to the ssh server, the ssh client will check if the server is still alive every once in a while. This will keepp traffic alive which means that whatever is in between will not terminate the connection. You will want this value to be small but not so small that it sends packagesevery second. For me, 120 (2 minutes) solves the problems but others may need to set it at 30. Add the following to /etc/ssh/ssh_config or to ~/.ssh/config file

ServerAliveInterval 120

* mount with the ServerAliveInterval option. Same as before but rather than configuring ssh, you pass this option when using sshfs. Basically, mount with the following command:

sshfs user@host:dir mountpoint -o ServerAliveInterval=120

* use the sshfs specific reconnect option (I haven't tested this option)

sshfs user@host:dir mountpoint -o reconnect

For more information see "man ssh_config" for all ssh options and "man sshfs" for the sshfs specific options.

I do believe that this is poor design of sshfs but in their opinion the problem is that the user doesn't have its ssh client configured properly.