Roll Your Own Secure Cloud Storage With Sshfs - Secure Shell File System

Continuing with SOCKS5, SSH, Public Key Pairs and fingerprints, Darren and Shannon use SSH to create a secure remotely mounted network file system with implementations in both Windows and Linux.

Using the SSHFS utility we're able to mount a remote filesystem. Since we already have a secure tunnel to our server over SSH, which we've been thus far using as a SOCKS5 proxy, we're now able to store files securely online with the same mechanism. Using FUSE, or File System in User Space, we're able to achieve this without the need to load kernel modules -- a process which would require superuser privileges.


SSHFS on Linux
As Darren demonstrates in Linux the setup is quite simple. Begin by installing SSHFS. From ubuntu that's "sudo apt-get install sshfs". Once installed your user will need to be added to the fuse group, so issue "sudo gpasswd -a $USER fuse". The $USER is an environment variable which will be replaced with your username on execution. Issue "whoami" if you're not sure of your username.

Once SSHFS has been installed and your user added to the fuse group you're nearly ready to mount the remote file system. Begin by making a directory. This directly will act as the mount point for the remote file system. Issue "sudo mkdir ~/sshfs" to make an sshfs directory in your user's home.

Finally we're ready to mount the remote file system. If you've been following along thus far and have setup authentication key pairs for your SSH server the following should be pretty seamless. Issue "sshfs -o idmap=user username@host: ~/sshfs". Replace username and host as appropriate. The colon (:) after the host specifies the location on the remote server to mount. For example, if permissions allowed, /var/www/ could be mounted. Leaving the location as colon (:) defaults to the user's home directory. Now navigate to ~/sshfs on your local system and behold the remote file system!

SSHFS on Windows
As Shannon demonstrates, ExpanDrive offers SSHFS for Windows. In addition ExpanDrive will mount virtual drives from Amazon S3 and even FTP. The software is $40 with a 30-day trial. It supports SSH public keys directly or with pageant.