sshfs-win

sshfs-win

Windows 下挂载 ssh fs。需要安装最新版(2021以后)的 winfsp

net use X: \\sshfs\root@1.2.3.4
net use X: \\sshfs\root@1.2.3.4!2222

路径语法:

\\sshfs\[LOCUSER=]REMUSER@HOST[!PORT][\PATH]
\\sshfs.r\[LOCUSER=]REMUSER@HOST[!PORT][\PATH]
\\sshfs.k\[LOCUSER=]REMUSER@HOST[!PORT][\PATH]
\\sshfs.kr\[LOCUSER=]REMUSER@HOST[!PORT][\PATH]
  • REMUSER is the remote user (i.e. the user on the SSHFS host whose credentials are being used for access).
  • HOST is the SSHFS host.
  • PORT is the remote port on the SSHFS host (optional; default is 22).
  • PATH is the remote path. This is interpreted as follows:
    • The sshfs prefix maps to HOST:~REMUSER/PATH on the SSHFS host (i.e. relative to REMUSER's home directory).
    • The sshfs.r prefix maps to HOST:/PATH on the SSHFS host (i.e. relative to the HOST's root directory).
    • The sshfs.k prefix maps to HOST:~REMUSER/PATH and uses the ssh key in %USERPROFILE%/.ssh/id_rsa (where %USERPROFILE% is the home directory of the local Windows user).
    • The sshfs.kr prefix maps to HOST:/PATH and uses the ssh key in %USERPROFILE%/.ssh/id_rsa.
      LOCUSER is the local Windows user (optional; USERNAME or DOMAIN+USERNAME format).
      Please note that this functionality is rarely necessary with latest versions of WinFsp.

已知问题

写入挂载的 Windows 10 openssh server 路径时出错

这种写入 bug 很多。

无法挂载 Windows 10 openssh server 非系统盘符路径

例如:

net use Z: \\sshfs.r\user@host!port\Z:

会报错 System error 67. 原因是路径里的 : 字符导致的。

解决方法:

不要用 net use,直接用 sshfs-win 的 sshfs-win.exe CLI 程序挂载。

一个 workaround:

在 Windows 10 openssh server 的下用 mklink /J 创建其他盘符的目录联接,例如可以在 %USERPROFILE% 下运行:

mklink /J d D:

这样用户主目录(sshfs-win 挂载时的默认路径)下的 "d" 就是一个指向 D: 盘的符号链接,实测 sshfs-win 挂载后能够正常识别并读取这个符号链接里的内容。


Last update: 2021-04-01 06:22:48 UTC