winfsp / sshfs-win

SSHFS For Windows
https://winfsp.dev
Other
4.78k stars 250 forks source link

How to prevent a connection timeout (solution for reference) #420

Closed Swift42 closed 3 months ago

Swift42 commented 3 months ago

When you connect a drive letter via "net use", the connection will timeout after some minutes and you need to reconnect it again. This means: You have to use "net use" again (on a non-persistent connection) or you need to click again on the drive in explorer (on a persistent connection).

This can be prevented by modifying the registry - by appending " -o ServerAliveInterval=30" to "CommandLine" in HKLM\SOFTWARE\WOW6432Node\WinFsp\Services\sshfs (or sshfs.k/sshfs.kr/sshfs.r if you use this variant).

Here is a registry command file for the standard "sshfs" variant:

[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\WinFsp\Services\sshfs]
"CommandLine"="svc %1 %2 %U -o ServerAliveInterval=30"
billziss-gh commented 3 months ago

@Swift42 this seems significant enough that should be added to the README?

Swift42 commented 3 months ago

@Swift42 this seems significant enough that should be added to the README?

I would say yes, because I was annoyed by the constant timeouts (disconnects) and I spent some hours to figure out how to prevent this. I first tried to set the parameter in %USERPROFILE%.ssh\config, but this didn't work. It works when you call "sshfs-win svc" manually (and add the parameter), but IMO it is more convenient and better to simply use "net use" with the registry patch from above.

billziss-gh commented 3 months ago

Would you want to make a PR adding this information to the README?

Swift42 commented 3 months ago

Would you want to make a PR adding this information to the README?

I created a PR with a modified README and a registry patch file for all 4 services (sshfs, sshfs.k, sshfs.kr, sshfs.r).