Linux Terminal: sshfs, Remote directory over ssh

Often one wants a shared access to files across machines. Traditionally one uses the network file system (nfs). The network file server works as follows: There is an nfs server that exports some directories in its filesystem hiearchy to various nfs clients that mount these directory over the network into their file system hierarchy. As a result, each of the clients shares the directories exported by the nfs server.
However a lot of times you just have to mount a directory from a server to your local computer and in these cases NFS it’s not so useful, sshfs it’s much better
Sshfs 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.

How it works.
Sshfs is a userspace file system (fuse) that works over ssh, or rather sftp. Fuse is an implementation of filesystem primitives in userspace rather than in kernel space. This essentially means that users can mount and unmount file system without having to be root. Sshfs makes use of the sftp subsystem to do the remote file system operations. Thus all the great features of ssh holds true, i.e. key based authentication, use of ssh-agents.
Installing sshfs.
All linux distros have a prebuilt package for sshfs. On Debian/Ubuntu and Arch the relevant package is sshfs. So all you need to do is to install it.
$ aptitude install sshfs # as root.
$ sudo aptitude install sshfs # if you are on Unbutu
$ pacman -S sshfs # as root on an Arch machine
On Fedora it looks like it is called fuse-sshfs

Read more at Linux Aria

Comments are closed.