Get in touch:
01524 851 877
07718 896 553

SSHFS – Mounting Remote Directories Over SSH

Posted on Jun 20 2008

For a while now I have been wondering how easy it is to mount a remote directory. I have always known there must be a way to do it but had never actually got around to looking it up. It was only the other day when someone showed me SftpDrive, an application for windows that allows you to mount remote directories over SFTP.

This got me searching around for a similar method for Linux. I just wanted to be able to mount a directory on a remote machine and be able to access it as though it was a directory on my local machine. My searching led me to SSHFS.

SSHFS allowed me to do exactly what i want. A simple ‘apt-get’ in Ubuntu installed it and I was ready to go. You need to add yourself to the fuse group after it has been installed (adduser fuse) and then restart your terminal. (You may also need to ‘modprobe fuse’)

Once this is done you are ready to go, simply mount a remote directory using a command like ‘sshfs username@hostnema:/remote/path/ /local/path’

Make sure you have made a directory somewhere on your local machine to be the mount point and chown’d it using ‘sudo chown your-username /local/path’.

All being well you should now have your remote directory mounted as if it was on your own machine. I have found this extremely useful for working on a few web based projects. Another thing that it is very useful for is running backups of my remote servers. A simple cron job running a script to backup your remote servers works a treat.