Mount remote SSH drives in Ubuntu with SSHFS

Posted under » Ubuntu » Linux on 19 March 2012

Network is essential. Rsync has been useful but sometimes you need to access a file as if the file is local. I've used other solutions like Open AFS, Dropbox, Samba and the likes but this is the best solution IMHO. However you need a good and stable internet connection for this to work flawlessly.

SSHFS is a tool that uses SSH to enable mounting of a remote filesystem on a local machine; the network is (mostly) transparent to the user. Because SSHFS authenticates connections, you can be sure that only those who should have access to remote directories can mount them (as long as everything is configured properly). You have to install this because it is not a standard installation.

You do not need to be root to do this but you must belong to the fuse group. Of course you need to install SSHFS first then add yourself to the fuse group:

sudo gpasswd -a $USER fuse

In this example, the remote directory is /projects on remote host "myserver.com". The local mount point is ~/far_projects.

mkdir ~/far_projects
sshfs hanafi@myserver.com:/projects ~/far_projects -o reconnect -C -o workaround=all

~/far_projects will appear like a mounted drive. To unmount

fusermount -u ~/far_projects

Your ssh session will automatically log out if it is idle. To keep the connection active (alive) add this to ~/.ssh/config or to /etc/ssh/ssh_config on the client.

ServerAliveInterval 5

Sometimes, things go wrong and you get this kind of error. "fuse: bad mount point" and "Transport endpoint is not connected". The solution is to


web security linux ubuntu python django git Raspberry apache mysql php drupal cake javascript css AWS data