Sunday 12 August 2012

sshfs

A colleague just pointed out a utility to me, which is making some things a lot easier: sshfs

Let's assume you want to edit a text file on a remote server (or visualize a molecular structure file etc.). One option is an editor inside the shell like vi, but in many cases it is helpful to have a more extended editor, use the mouse, etc. You can start this editor through X-windows but if you do not have a very good connection, this will take a long time. Coyping the file to your local machine is an option but can be tedious and there is always a potential for creating a mess if you have different versions of a file on different machines. The way out is sshfs, which let's you address remote files as if they were part of the local file system.

First make sure it is installed
yum install sshfs

Then create the mount point
mkdir /home/yourname/remote1

Mount the remote file system with sshfs
sshfs user1@remote.com:/remotehome/user1 /home/yourname/remote1

Moreover, if you use ssh keys, you will be able to address the remote file system without entering any passwords.

For Windows users there is win-sshfs. This lets you address the files in the sense of a remote network drive and therefore has increased functionality as opposed to the simpler win-scp. But watch out: If you edit a unix file in windows, the editor will change the line break characters, which might mess up the Unix parser and it is not so trivial to revert this (as I just noticed ...)

No comments: