(see also the email sync and the unison filex in the oqo folder)
sshfs lets you mount a remote computer as a local folder via ssh -- it's really sweet.
To install:
apt-get install fuse-utils sshfs
Example usage:
mkdir /home/bshanks/w # create a mount point sshfs -o reconnect bshanks@example.com: /home/bshanks/w
The -o reconnect
enables sshfs's reconnect option, which i assume means it reconnects if it gets disconnected. the bshanks@example.com:
says to login as user bshanks at example.com, and to go to bshanks's home directory there. The /home/bshanks/w
is the local mount point.
To unmount, use
fusermount -u -z /home/bshanks/w
The -u means unmount, and the -z means "lazy unmount", which means that it unmounts even if the directory is busy.
You can put sshfs into /etc/fstab
like this:
sshfs#bshanks@example.com: /home/bshanks/w fuse defaults,user,reconnect 0 0
The "user" means that ordinary users are authorized to issue mount
and umount
commands.
But I am just too lazy to type mount
and umount
. Using afuse
, you can make it mount and unmount automatically when you access the local directory.
To install:
apt-get install afuse
afuse creates a virtual directory; when you try to access a subdirectory inside of it, the name of the subdirectory is taken as the address of the remote computer. So what we'll do is create a mountpoint for the virtual directory, and then create a symbolic link inside of that for a frequently used remote computer.
Example usage:
First, create a mountpoint for afuse
mkdir /home/bshanks/afused # create ln -s /home/bshanks/afused/bshanks@example.com:
Now, put something like this into ~/.bashrc
:
fusermount -u -z /media/afused/bshanks afuse -o timeout=1800 -o mount_template='sshfs -o reconnect %r %m' -o unmount_template='fusermount -u -z %m' /home/bshanks/afused/ &
First, the fusermount command unmounts things in case something is screwed up.
The afuse command create a virtual directory at the mount point /home/bshanks/afused/
. The
The afuse command is backgrounded so that in case it hangs, it doesn't lock you out (since this is in .bashrc).