sshfs - secure and transparent access to remote filesystems
sshfs is a very slick way to access your remote filesystems, securely and transparently. It is based on the great FUSE (Filesystem in Userspace) framework, which has been integrated in the linux kernel since version 2.6.14. While sshfs may not be as fast and featureful as other full-blown network filesystems such as NFS or Samba, it still has some great features:
- very easy to use, 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
- provides secure (encrypted) access to remote files
- has decent performance (multithreaded, caching directory contents and allowing large reads)
- should work well even over slow and/or unstable links (think dialup), knows how to reconnect to the server when the connection is broken
There is nothing special you need to do on the server side. Just make sure you have standard SSH daemon configured and running.
On the client side you need kernel compiled with the FUSE support (CONFIG_FUSE_FS=y). Of course, you can also compile FUSE as a module (CONFIG_FUSE_FS=m).
Next, you need to install both FUSE userspace part & sshfs. You can download and compile sources from FUSE project page & sshfs-fuse project page. Or if you're lucky and somebody has already prepackaged sshfs for your linux distribution, you could do just:
apt-get install sshfs
That command (tested on Debian testing/unstable) would pull all the needed dependency packages (libfuse2, libglib2.0-0, fuse-utils) for you.
Finally, as sshfs is designed to be used by regular users (not under superuser privileges) you should add yourself (and possibly others) to the fuse system group. Something like this should do:
usermod -a -G fuse <username>
You need to logout and login again after that command, so that additional group becomes active for your userid.
If you have successfully finished the above configuration, you should now be able to type:
sshfs remote_machine:some/dir local/dir
If everything is OK, that command will make
some/dir on remote_machine available locally in the
local/dir hierarchy. You can now perform operations on such mounted files just like you would if you were logged in on the remote_machine.
Unmounting is also simple, just do:
fusermount -u local/dir
This fine utility is able to speed up some common tasks like copying file trees from one machine to other, editing remote files and similar. The author of this article has been using it for few months over a rather slow DSL line and it never failed.