Work locally on a remote project with any editor in combination with SSHFS

How often does it happen that you need to edit files remotely while your favourite editor is not capable to do so?

My favourite editor is Komodo Edit, the free edition of the commercial Komodo IDE. Unfortunately this editor is not able to handle remote projects but only single files.

komodo_alert

To work with a remote project there’s a simple workaround. The trick is to use sshfs – a SSH Filesystem client to mount and interact with directories and files located on a remote server or workstation. Essentially the SSH File Transfer Protocol (SFTP) will be used in conjunction with the Secure Shell protocol version 2 (SSH2).

Installation

In common linux distributions the package is named sshfs which after the installation is used as follows.

# Debian/Ubuntu
sudo aptitude install fuse-utils sshfs

# Open Suse
sudo zypper install sshfs

# Fedora
sudo yum install fuse-sshfs

# Arch Linux
sudo pacman -S sshfs

You need to be in the fuse group to use sshfs as a non-root user.

$ usermod -a -G fuse 

Mount a remote filesystem

sudo sshfs root@myremoteserver.com:/var/lib/redmine/plugins /mnt -p 12345 -C

In this example we want to mount the remote fileystem to /mnt and thus we need root permissions. The sshfs command is then passed the user, the host with the path, the mountpoint and finally additional SSH options e.g. a non-standard port the ssh server is listening to.

You will be prompted for your local root password and if you are using password authentication instead of public key authentication you’re asked for a password a second time, for the server.

If you get a Transport endpoint is not connected error message read this article.

After this you’re able to use the content of the mounted filesystem as it was local. Create projects, read and alter files.

komodo_with_sshfs

Be aware that you can’t always write to your mounted filesystem but this depends on the user/path combination used. The file permissions might not be sufficient to alter the content in the specified path.

For some quick edits I just decided to permit temporarily the root login with a 20 characters long password which is fairly secure enough.

Unmount the remote filesystem

After your work is done simply unmount your filesystem with

sudo fusermount -u /mnt

Troubleshooting

Consider the FAQ or post a comment with your issues.

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>