Please feel free to email me with any questions at with "blog" as the subject.

Search my blog:

Loading...

Saturday, 18 September 2010

Secure SHell FileSystem - SSHFS

SSHFS (SSH FileSystem or Secure SHell FileSystem) is a filesystem client to mount and interact with directories and files located on a remote server or workstation.
The client interacts with the remote file system via SFTP.

SSHFS works on most UNIX and Linux systems. The current implimentation is based on
FUSE.

As it uses ssh it is more secure than samba.

To run sshfs you need to install fuse as well. If you install SSHFS through a package manager it will install all dependancies.

For example:

bash$ sudo pacman -S sshfs (Arch)

bash$ sudo apt-get install sshfs (Debian and derivatives)


Once installed, you can mount any location on a remote server that you have ssh access to.

You need to have made the mountpoint (The location the remote directory will be mounted) first:

bash$ mkdir /path/to/MOUNTPOINT

You may then mount the remote directory into the mountpoint. This is done by:

bash$ sshfs USERNAME@SERVER:LOCATION MOUNTPOINT


The mountpoint now appears to contain the contents of the mounted directory on the remote server.

You can now interact with the contents as if it was on the local machine but you will be using the permissions of the user you mounted it with.


For example:

bash$ mkdir /server1
bash$ sshfs user@192.168.1.2:~/home/user/ /server1

would be used to mount the directory /home/user on the remote server in directory /server1 on the local machine.

To unmount mounted directories simply use:

bash$ fusermount -u MOUNTPOINT

In my example this would be:

bash$ fusermount -u /server1