Specialist Web 2.0 Project Management

We know Web 2.0. We know Project Management.

SSHFS on the EeePC

I liked the look of DropBox, but couldn’t get the client to work on my EeePC. Instead, I found a do-it-yourself solution that allows me to easily share files between my computers, using my web server to store the files.

I need to write up a little more about how to synchronise things with rsync, but I’ll leave that for another day.

Here’s how I did it:

1. Add repository to /etc/apt/sources.list

sudo nano /etc/apt/sources.list

add the following line at the end:

deb http://http.us.debian.org/debian stable main

2. Grab the SSH, SSHFS and FUSE packages

sudo apt-get install ssh sshfs fuse-utils

3. Fix permissions on fusermount:

sudo chmod a+x /usr/bin/fusermount

4. Create your mount directory

mkdir /home/user/remote

5. Mount your remote filesystem

sshfs remoteuser@remoteserver.com: /home/user/remote

This will mount the home directory of remoteuser on remoteserver.com onto the local /home/user/remote directory. Very cool.

6. Automate the connection

The steps shown below create a public/private RSA key pair with an empty passphrase, append the public key to the authorized keys file in the remote home directory, and set the correct permissions.

Make sure your remote filesystem is mounted before continuing. Use something like this to check:

ls -a /home/user/remote

That should list the files in the remoteuser’s home directory.

a)

We will no longer need to enter our password when mounting this particular remote directory.

Next, we test the trust relationship created with the key pair.

b) Unmounting the remote directory

fusermount -u /home/user/remote

c) Testing the trust relationship

ssh remoteuser@remoteserver.com uptime

If you get an output to the ‘uptime’ command - rather than an error - all is well and the trust relationship works.

d) Mount the remote directory again

sshfs remoteuser@remoteserver.com: /home/user/remote

This time, you shouldn’t need your password. You can now browse to the /home/user/remote directory and access it as you would any other. Naturally, access will be a little slower than for the local filesystem.

7. Making things easier: aliasing the commands.

Here’s how I make life easier by creating aliases

a) creating ~/.bash_aliases
cd ~
touch .bash_aliases
nano .bash_aliases

add the following lines:

alias mntr=’sshfs remoteuser@remoteserver.com: /home/user/remote’

alias umntr=’fusermount -u /home/user/remote’

b) configuring bash to use the .bash_aliases file

nano ~/.bashrc

go to the #Alias definitions section and uncomment the lines to look like this:

if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi

You are all set now. Open a new terminal with Ctrl+Alt+t.

Type ‘mntr’ to mount your remote directory
Type ‘umntr’ to unmount it.

Source: http://www.linuxjournal.com/article/8904

2 Responses to “SSHFS on the EeePC”

  1. DavidS Says:

    Thanks for this. It worked for me.

    Step 6 seems to be incomplete though.

    Also able to use scp on the command line like this:

    #>scp

  2. DavidS Says:

    Command should read

    scp “local_file” “mounted_sshfs_directory”

Leave a Reply