Mount a remote filesystem using SSH via SSHFS

October 1, 2009 by: Allen Sanford

You like hundreds of other people have decided that it is easier to work on files using a program like Geany, Jedit, or gedit, but your files are located on a remote machine. Some of the GUIs out there have SFTP modules, but you still need good old Filezilla or some program similar to transfer images and you would still need a terminal for a few other odd end things. It would be neat if one could mount a remote file system on your local computer, and access files the remote host as if they were local files on your pc, right? Well, What if I told you there was a way. I am talking about mounting the remote file system using SSHFS.
The following guide will show just what you need to do to mout remote file systems over ssh.

SSHFS:
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.

If you don’t already have sshfs installed or don’t know if you do or not you can run this command and install it:

    sudo apt-get install sshfs

This will also install fuse-utils and libfuse2, which are required.

Now, we are going to make a place to mount the remote file system locally. I usually just make a directory in my home directory to mount to because it is going to make a desktop icon for us to use anyway (At least on Ubuntu it will). The name I use for all my examples of my server is shual so I make this directory now.

    mkdir ~/shual

Now it is time to mount the remote file system, make note you can mount any folder or sub-folder that the user you are using has access to.

    sshfs www-remoteuser@example.com:/var/www ~/shual

At this point you will either have to give your password and the remote system will be mounted for your use.

Now I guess you need to know how to unmount it

    fusermount -u ~/home-pc

Enjoy and Have a Good’n!

Filed under: SSH
Tags: ,

Comments

One Response to “Mount a remote filesystem using SSH via SSHFS”

Leave a Reply