「SSHFS」- 通过 SSH 挂在远程目录

sshfs用于将远程服务器的目录挂载到本地目录中,可以达到像编辑本地文件一样直接编辑远程服务器文件,而不再需要那种“繁琐”操作(先ssh到远程服务器,再执行vim编辑文件,当然某些情况下,还是需要这种“繁琐”操作的)。

虽然sshfs不支持Windows系统,但是Windows中可以使用替代品win-sshfs,一样的效果。

在 Linux 中,使用 sshfs 工具

https://github.com/libfuse/sshfs
Solving SSHFS ‘Permission Denied’
How To Use SSHFS to Mount Remote File Systems Over SSH

sshfs -o allow_other,defer_permissions,IdentityFile=~/.ssh/id_rsa \
    root@xxx.xxx.xxx.xxx:/      \
    /mnt/droplet

allow_other:允许其他用户访问

在 Windows 中,使用 win-sshfs 工具

安装依赖

由于win-sshfs依赖于Dokan,所以先安装Dokan后再安装win-sshfs。
Dokan项目地址:https://github.com/dokan-dev/dokany
Doken下载地址:https://github.com/dokan-dev/dokany/releases
有关Doken版本的选择及安装,参考:https://github.com/dokan-dev/dokany/wiki/Installation

因为使 Windows XP 系统,所以使用 0.6.0 版本。文档有说明:https://github.com/dokan-dev/dokany/wiki/Installation

双击运行 DokanInstall_0.6.0.exe 进行安装。

下载并安装

win-sshfs项目地址:https://github.com/Foreveryone-cz/win-sshfs
win-sshfs下载地址:https://github.com/Foreveryone-cz/win-sshfs/releases

双击运行 win-sshfs-0.0.1.5-setup.exe 进行安装。

附加说明

如果访问有问题,Dokan和win-sshfs的下载也可以使用:http://pan.baidu.com/s/1hrGcHkK

使用方法

如图所示,点击 <Mount> 后,会将 10.10.30.2 / 目录挂载到 H 盘:

常见错误列表

#1 Hostname not valid
https://github.com/bycn82/win-sshfs/issues/85

问题原因:没保存。。。。。挂载前,先保存。
解决办法:Hit <save> before clicking <mount>

参考文献

win-sshfs的使用