ItecSoftware Logo

Mount Remote Folder with SSH using SSHFS

Written by Peter Gilg on - like this:
mount remote folder with sshfs

If you do any type of serious web or application development, you’re certainly used to working with remote servers and networked systems. You work locally, create test cases and do some kind of qa before deploying to the live system. But what if your qa / test system is also remotely? Wouldn’t it be nice if you could just work as if your files were local and have changes sync automatically?

Mount remote folder with ssh using sshfs makes it possible. Be careful as all changes are reflected on your remote server immediately and without warning. If you’re often working with remote servers, directories and files, then you know how annoying it can become to constantly sync your content using ftp, ssh, sftp or some other method.

Following are the steps necessary to accomplish this:

Install sshfs

$ sudo apt-get install sshfs

This will also install fuse-utils and libfuse2, which are required for sshfs to work properly.

Create a folder to serve as mount location

$ mkdir ~/mount/some-name

Add your user account to the group

Your account will need the necessary access privileges for sshfs. After this command, you will need to logout and log back in for the changes to take effect.

$ sudo adduser your-username fuse

Mount the remote filesystem

Now mount the location using the following syntax: sshfs user@host:/remote-folder local-mount

$ sshfs user@example.com:/web ~/mount/localweb

That’s it, you should now have a local folder with all the files from the remote location. You can work with them as if they’re local and see the effect on your remote location in real time. Keep in mind though that any mishap or coding error will be reflected immediately as well.

Listed in Linux

Tags: mount, ssh, sshfs

2 responses to “Mount Remote Folder with SSH using SSHFS”

  1. Jim says:

    Thanks for the instructions. Really helpful.
    Btw, can you use subversion using sshfs mount?

Leave a Reply

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