- Install sshfs and autofs:
sudo aptitude install sshfs autofs
- Add yourself to the fuse group:
sudo gpasswd -a $USER fuse
- Log out and in again.
- Generate a private key (~/.ssh/id_dsa_open) without passphrase, and a corresponding public key (~/.ssh/id_dsa_open.pub):
ssh-keygen -t dsa -f ~/.ssh/id_dsa_open
(press enter to keep the passphrase empty; it has to be passphrase-less, because autofs runs as root so can't use your ssh-agent to handle the passphrase)
- Copy the public key into ~/.ssh/authorized_keys on the remote host:
ssh-copy-id -i ~/.ssh/id_dsa_open.pub remoteusername@example.com
- Test that root can log into the remote host using the new key pair:
sudo ssh -i ~/.ssh/id_dsa_open remoteusername@example.com
- Add a new entry to /etc/auto.master:
/media/sshfs /etc/auto.sshfs --timeout=3600 --ghost --verbose
(the remote folders will be mounted locally at /media/sshfs; change this if you like)
- Add one or more entries to /etc/auto.sshfs:
foldername -fstype=fuse,rw,allow_other,noatime,IdentityFile=/home/localusername/.ssh/id_dsa_open :sshfs\#remoteusername@example.com\:/path/to/folder
(replacing "foldername" (the name of the local folder that will be created), "localusername", and the sshfs information as appropriate)
- Restart autofs:
sudo restart autofs
- Open /media/sshfs - the remote folder(s) should now be mounted there.