1

On my laptop, I often mount the content of my NAS through sshfs, for ease of access. I usually do so with an ethernet cable plugged in, as it makes browsing the files more smooth than with wifi. But sometime, I need to unplug, while still being connected to the same network through wifi. However, this makes sshfs unresponsive ; any attempt to access the content of the nas directory freezes until I either plug the Ethernet cable again, or kill sshfs, in which case I have to unmount, then mount again. The main issue is that unmounting requires me to close the half-dozen terminals that are already in the nas directory.

One solution would be to force sshfs to use the wifi connection even when connected to the ethernet. (ssh has an option for that, so I assume sshfs as well.) However, I would lose the benefit of smooth browsing, and some movies become entirely unwatchable.

So is there any method so that sshfs can use either wifi or ethernet depending on which is available, without having to unmount and remount ? (Or another command entirely that performs a similar function and does what I want.)

1 Answer 1

1

When you connect, use the -o reconnect flag:

$ sshfs -o reconnect [email protected]:/remote_path /local/path
1
  • 1
    I also added ServerAliveInterval=5,ServerAliveCountMax=1 to the options so that it reconnects faster, and it works perfectly, thank you. Commented Jul 7, 2020 at 19:13

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.