Sunday, February 17, 2013

Mount remote directories in your local machine

sshfsmount
I have my Music and Video directories in my B3 Server. To access them locally I mount them using sshfs.

In order to not think about it, I created a script that runs at boot time to take care of that for me.

The script is available at my github account in a repository called sshfsmount.


Installing sshfs

First of all you need to install sshfs:
$ sudo apt-get install sshfs

Get the code

Get the code from my sshfsmount github repository:
$ cd ~/Downloads
$ wget -O sshfsmount.zip https://github.com/paapereira/sshfsmount/archive/master.zip
$ unzip sshfsmount.zip
$ chmod +x sshfsmount-master/sshfsmount.sh

Configure the mountpoints

Change the mountpoints configuration file to add your directories:
$ vi sshfsmount-master/config/sshfstab

Running

To mount all the directories in you configuration file:
$ sshfsmount-master/sshfsmount.sh mount
To re-mount all the directories in you configuration file:
$ sshfsmount-master/sshfsmount.sh re-mount

Running at startup

Go to the Startup Applications and add a new Startup Program:

Mount your remote directories at startup