>sshfs: another useful Linux tool

>Ok, I just had to share this tool – I’m sure anyone who’s familiar with Linux already knows it, but just in case there are people out there who are behind me on the Linux learning curve, this one is worth knowing: sshfs

If you’ve never heard of it before, the full name is the ssh file system. What it does is quite simple: it allows you to mount any ssh accessible directory as a local file system. It’s not any faster than ssh access would be, and apparently (from various sources on the web) it doesn’t do well under huge stress, but for my purposes, it’s been brilliant.

Normally, if I want to do anything with my work account, I have to ssh into the work machines, then download/scp files all over the place, leaving several copies on each of the computers I work on. This inevitably leads to version-ing nightmares.

This is where sshfs steps in. Instead of copying files, I now just mount each of the ssh accessible computers are mount points, and operate directly over the ssh share. It’s pure genius.

To use it, you need to install the sshfs package, which is trivially easy on Ubuntu or another debian based system:

sudo apt-get install sshfs

Then you need to create the mount point (which I usually do in /media, just for ease of use), and assign yourself permissions to use that mount point. This is done with your own username on the local machine, and doesn’t change the permissions on the server.:

cd /media
sudo mkdir servername
sudo chown username.username servername/

This sets up a point for you to attach the server. All that’s left is then to attach the directory on the server to your local mountpoint, using a command eerily similar to scp’s:

sshfs username@servername.example.com:/home/username /media/servername/

Tada. All that’s left is to open your file manager of choice and open up the directory.

If only I’d discovered this tool sooner!

Leave a Reply

Your email address will not be published. Required fields are marked *