这个想法的灵感来自这篇文章。该文提到了在Mac OS下使用FUSE for OS X和Macfusion实现了“将远程服务器的文件系统映射成本地文件系统的一部分(通过SSH)”。
于是很自然地,我相信在Linux下也有对应的软件可以做同样的事情。
This idea was inspired by this article, which mentioned that the author used FUSE for OS X and Macfusion to map the remote server as a local directory via SSH.
So I searched the alternative on Linux and find the “sshfs“ package is just what I need, which is just a 40KB package file. Here’s how to do so:
1 | # If you want to create an user on the SSH server side with which to login the SSH server from a client, you can do like below on the server side: |
1 | # In this example, it assume your current local user account is "auser", and you have already created the "auser" account on the remote SSH server. All the following commands run on the local computer and the remote server should be accessable via SSH. |
Then you should see a mounted “disk” named “ssh71” in your file manager(such as Nautilus), just like what you see after you plug a flash drive in your USB port. Then you can use remote file system as a local flash drive, which is very handy.
And of cource, it won’t work after you restart your computer. You can run the “sshfs” command after you restart your computer, or save it as a script and run it.
Added@20130218:
You can use the “ssh-copy-id” command from the client computer to let the SSH server knows the client and it won’t need the client input the password anymore(from here):
1 | ssh-copy-id auser@172.16.10.71 |