Have you ever wanted to work with files on your remote server using your favorite text editor (which doesn't support SFTP)? I know this was a struggle for me, until I switched my laptop to Linux. Now I can just mount the folders from my server to my local filesystem, and use GEdit (gnuedit). Basically Linux (and other *nix OS) is Awesome! Being able to take small applications and make them work together is a huge benefit.
This weekend I got a new (refurbished, old laptop. pre IME) which I have decided I want to run Linux on Full-Time. One thing I have always hated about working on Windows and Mac laptops is the need to run a bloated text editor like Atom, or VS Code. Mainly, to be able to connect to my remote development server with a treeview file browser, with automatic upload on save. This is something that I grew accustom to, when I used to develop using Macromedia Dreamweaver and PHP3. On windows and mac the feature has to be build into the application to consistently work well. While there are solutions to mount a remote folder to a local drive on both windows and mac, they fall short in many aspects. So, let's get started.
Install SSHFS & Create Mount Point
On Debian based Linux Distros, this is rather simple.
$ sudo apt-get install sshfh
In a *nix filesystem, you must have a place already created to mount the remote (or local) folder/directory to. I like creating directories in the /mnt path to use as mount points. For example on my current system, I have /mnt/web-dev, /mnt/web-prod, /mnt/media-share
$ sudo mkdir /mnt/media-share
SSHFS (SSH FileSystem) to mount remote folder
All that is left to do now is actually mount the remote folder. This can be done by typing in something like the following and replacing the mount point and server information with yours.
$ sudo sshfs -o allow_other,default_permissions [email protected]:/home/user/ /mnt/media-share
It is probably a good idea to unmount the remote directory as soon as you no longer need it. This is achieved with a simple umount command.
$ sudo umount /mnt/media-share
As a script or two
I recommend, saving this as a script or two, which you can run when you want to connect to a remote filesystem. I think leaving remote connections open for long periods of time, is like asking for trouble.
Using nano type in the above into files in your home directory. Don't forget to update file permissions to the two files, chmod ug+x ./filename.sh