Sunday, August 21, 2011

remote storage with sshFS + EncFS

I wanted an easy, lazy, transparent and somewhat secure way to store files on my remote Linux server while I was on the road with my Linux Laptop. Combining SshFS and EncFS has been a great way to achieve this.

SSH Filesystem (http://fuse.sourceforge.net/sshfs.html) is a file system client that allows you to mount a remote directory on your client machine over SFTP. I find this incredibly useful and reliable and have used it in a number of situations.

$ sshfs -o IdentityFile=/home/desktopuser/.ssh/private.key -o port=2222 -ouid=2000,gid=2000 user@remoteserver.com:/home/user/storage /mount/remotestorage

A description from the EncFS website (http://www.arg0.net/encfs):
EncFS provides an encrypted filesystem in user-space. It runs without any special permissions and uses the FUSE library and Linux kernel module to provide the filesystem interface.

$ encfs /mount/remotestorage /mount/remotecrypt

Now on my Laptop any files that I copy to /home/remotecrypt will be encrypted before they are stored on the remote server. The encryption offered by EncFS is not amazing but my goal here was convenience.