Mount Remote Folder with SSH using 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:
$ 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 firstname.lastname@example.org:/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.