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.
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).
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 email@example.com:/var/lib/redmine/plugins /mnt -p 12345 -C
Update (August 2015, 10th)
You can also mount your remote filesystem by using your ssh key.
sshfs -o ssh_command="ssh -i ~/.ssh/my_server_key" user@my_server:/srv/my_project ~/mnt/host_mount/
The following needs to be in your
HOST my_server HostName 22.214.171.124 Port 1234 User user IdentityFile ~/.ssh/my_server_key
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.
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
Consider the FAQ or post a comment with your issues.