Often you need to edit/modify a file on a remote server. Generally you can simply SSH into said server (assuming you have SSH access) and use a text editor (there can be only one: vim).
However, what happens when you need to edit said file with something else... say, an application that doesn't naturally run on the CLI? You might say "copy it to your local machine, edit and copy back"... that's a pain but could work. However, what happens if the file is in use (say by a web application) and you can't mv (or copy over) it?
Here's an actual use case: I'm a fan of isso, a simple commenting server app to integrate public commenting in blogs, web applications etc (see the end of this article as it uses isso for comments. Also see my article setting up isso here).
isso uses an sqlite backend (e.g. all data kept on server in a single sqlite file). On a few occasions I've needed to access and modify some of my post comments. Since it's sqlite, I could use something like db DB Browser for SQLite to open the file and make then write changes without needing to copy the file, edit, and then copy back... however, it's on my server... which brings us to SSHFS.
With SSHFS, I could mount the remote server folder locally on my main machine (which is running Linux of course ) then use DB Browser for SQLite to open the sqlite db, modify and write changes, then umount.
You might already have SSHFS installed on your distro. If not, install from your package manager. If you're using Debian or Ubuntu Server, you would do a
Mounting a remote folder
I assume you have SSH configured and you can SSH into your server (if not see here).
If you can SSH into your server with a simple
then you can mount a remote server folder locally with:
For example, to mount my "isso" home folder on my server to
/home/user/isso I would do
If you have already created your local mount point (folder) then you don't need to run the
mkdir command above every time.
Use a specific ssh .pem file
you can also use a specific ssh .pem file (key) with sshfs. You might want/need to do this if you have multiple ssh private keys for example. The command to do so is similar to above
You can unmount your sshfs mount by using