sshfs A network filesystem client to connect to SSH servers; SSHFS 文件系统

SSHFS 是一个非常方便的文件系统,我们可以在 linux 和 mac 平台上使用命令进行挂载远程文件系统,使得我们就像使用运行在本地的文件系统一样;

SSHFS 基于用户态文进系统(FUSE)创建,linux 上有 libfuse 和 内核集成的fuse.ko内核模块;mac上有开源的 osxfuse 或称为macfuse.

关于 libfuse 和 macfuse 的相关介绍和使用,我之前有在下面两篇博客介绍:

https://www.cnblogs.com/xuyaowen/p/fuse.html

https://www.cnblogs.com/xuyaowen/p/fuse3.html

https://www.cnblogs.com/xuyaowen/p/macos-ntf3g-ntfs-enable.html

下面介绍介绍一下,sshfs:

https://github.com/libfuse/sshfs

https://github.com/osxfuse/sshfs

libfuse-sshfs:

SSHFS allows you to mount a remote filesystem using SFTP. Most SSH servers support and enable this SFTP access by default, so SSHFS is very simple to use - there's nothing to do on the server-side.

osxfuse-sshfs:

This is a filesystem client based on the SSH File Transfer Protocol. Since most SSH servers already support this protocol it is very easy to set up: i.e. on the server side there's nothing to do. On the client side mounting the filesystem is as easy as logging into the server with ssh.

The idea of sshfs was taken from the SSHFS filesystem distributed with LUFS, which I found very useful. There were some limitations of that codebase, so I rewrote it. Features of this implementation are:

  • Based on FUSE (the best userspace filesystem framework for Linux ;)
  • Multithreading: more than one request can be on it's way to the server
  • Allowing large reads (max 64k)
  • Caching directory contents
  • Reconnect on failure

与 macfuse 和 sshfs 相关的还有个软件 叫 macfusion,可以实现远程挂载文件系统,当然其原理就是在sshfs上面套了个图形界面,方便管理;

macfusion2: http://macfusionapp.org/

但是由于时间比较久,如果使用最新安装的sshfs,可以创建软连接进行替换;osxfuse 官方wiki 中有提到命令;

Macfusion

To use Macfusion with the newer "FUSE for OS X"-based version of SSHFS, put Macfusion in your Applications folder and run the following commands in Terminal. See 3. under "Frequently Asked Questions" for more information as to why you might want to use Macfusion.

cd /Applications/Macfusion.app/Contents/PlugIns/sshfs.mfplugin/Contents/Resources
mv sshfs-static sshfs-static.orig
ln -s /usr/local/bin/sshfs sshfs-static

To revert the changes and use the old MacFUSE-based version of SSHFS that ships with Macfusion, run:

cd /Applications/Macfusion.app/Contents/PlugIns/sshfs.mfplugin/Contents/Resources
mv -f sshfs-static.orig sshfs-static

由于 macfusion 不支持m1平台,我在新平台和系统上已经不能运行了,所以在这里就进行展示了;

相关链接:2022年01月25日18:08:31 macos monterey 平台;

https://serverfault.com/questions/660160/openssh-difference-between-internal-sftp-and-sftp-server OpenSSH: Difference between internal-sftp and sftp-server

https://discourse.osmc.tv/t/how-to-sshfs-tutorial/77852/1 SSHFS 使用教程

http://www.admin-magazine.com/HPC/Articles/Sharing-Data-with-SSHFS SSHFS 安装和性能测试

https://github.com/osxfuse/osxfuse/wiki/SSHFS SSHFS macos 安装和使用;

更多内容,请关注cnblogs.com/xuyaowen;

posted @ 2019-12-12 22:26  Michael-Xu  阅读(321)  评论(0编辑  收藏  举报