Managing remote source via IDE : SSHFS

While you are working with remote source, it may find yourself uploading a script repeatedly to your virtual server to test. In such kind of scenario, that will be bit hassle.

So here is the simple solution. You can mount remote location with in your local machine and just do the development. SSHFS will do that for you :)

  1. Install sshfs in your local machine.

Linux

sudo apt-get install sshfs

Mac : Refer https://osxfuse.github.io/

Windows: Get latest win-sshfs package from https://code.google.com/archive/p/win-sshfs/

2. Make a directory in local which will going to mount with remote

mkdir /home/user/mount

3. Mount remote location

sshfs -o (permission options) user@<ip>:/remote_location local_folder

sshfs -o allow_other,default_permissions root@xxx.xxx.xxx.xxx:/ /home/user/mount

If you are access (ssh) remote location via public key, then use following command.

sshfs -o allow_other,default_permissions,IdentityFile=~/.ssh/id_rsa root@xxx.xxx.xxx.xxx:/ /home/user/mount

You are done with mounting ! :)

4. Open local folder with your IDE and make changes as you want. sshfs will make them remotely visible.

Note: When you restart your local machine, you have to remount remote location using above command in 3.

If you wanna add permanent mount, you can follow commands.

sudo vim /etc/fstab

Then go to the bottom of the file and add the following entry

sshfs#root@xxx.xxx.xxx.xxx:/ /home/user/mount

Now it will be a permanent mounted location even though you reboot remote/local instances.

Like what you read? Give Dilshani Subasinghe a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.