Mounting Your EVBackup Account with SSHFS / FUSE
Wouldn't it be neat if you could mount your EVBackup account just like a USB drive? Well, you can -- that is exactly what SSHFS / FUSE does for you. The steps to mounting are pretty simple:
- Make sure SSHFS or FUSE is installed.
- Create, upload and activate an SSH keypair to your EVBackup account.
- Create the mount point directory on your local filesystem.
- Mount the directory.
SSHFS Installation
To check whether you have SSHFS installed on your *nix machine, open up a terminal and enter the following command
whereis sshfs- If you see a path returned, you are good to go!
- If you see
rsnapshot:, then you need to get it installed.
- How do I install SSHFS? »
- « OK — Hide this.
Installing SSHFS may be as simple as using your package management system. Depending on your flavor of *nix, enter one of the following into a terminal:
- Ubuntu
sudo apt-get install sshfs- CentOS / Fedora / RHEL
sudo yum install fuse- OpenSuSE / SLES
-
sudo zypper install fusesudo zypper install fuse-devel - Other Flavors of *nix
-
The SSH Filesystem page
has instructions has the source ready for you to download and compile both FUSE
and SSHFS (yep — you need both.) Once downloaded,
compilation and installation follows the typical GNU Automake flow:
./configuremakeJust make sure to install FUSE before installing SSHFS.sudo make install - @#?! It Doesn't Work!
- Nobody was born knowing how to fly a plane, yet we still have pilots. Just send us an email — we're here to help:
Step One: Create an SSH Keypair with ssh-keygen
- Each of the following commands are entered as a single line.
-
You'll want to run all of the commands here as the 'super-user' (using
sudo), so that you have full access to all the files on your machine.
- 1. Create an SSH key pair with ssh-keygen
-
Note the command ends with two single quote characters.
sudo ssh-keygen -f /backup/ssh_key -t rsa -N ''
- Why do I need an SSH keypair? »
- « OK. Hide this
An SSH key pair allows you to securely login to your backup server without entering a password each time.
- 2. Upload and activate the public key to your EVBackup account
-
sudo rsync -e ssh /backup/ssh_key.pub user@user.evbackup.com:ssh_keys/key1.pubssh user@user.evbackup.com addkeysShow Me
- Notes about uploading »
- « OK. Hide this
- Substitute
userwith your EVBackup account name. - When you enter this command, you might see a message indicating that your computer is doesn't recognize the server. Just enter yes when prompted and you'll never be bothered again.
- You'll be asked to enter the password for your EVBackup account. Once the key is uploaded and activated, this won't be necessary again.
- If Terminal simply returns (looking as though nothing has happened), then you have successfully uploaded your key!
- 3. Test that you can login without a password
-
sudo ssh -i /backup/ssh_key user@user.evbackup.com- How do I know if it worked? »
- « OK. Hide this
If you were successful, then something very similar to the following will appear in Terminal:
Last login: Thu Jul 15 16:16:44 2010 from c-28-26-13-101.
Copyright (c) 1983, 1986, 1988, 1990, 1991, 1993, 1994
The Regents of the University of California. All rights reserved.
FreeBSD 6.4-STABLE (EXAVAULT) #1:
[your-account@quark ~]$
Step Two: Add the Mount Point and Mount Your EVBackup Account
Once you have SSHFS / FUSE installed and you can login without a password, you are set to go with SSHFS. You just need to create the mount point and mount your account.
- 1. Create the mount point directory
-
This can be wherever you would like, however typically mount points in *nix are placed in
/mnt. You may also want to place the mount point in /backup.
...where 'user' is your EVBackup user name.
sudo mkdir /mnt/user.evbackup.com - 2. Mount your account
-
Note: the following needs to be entered on one line:
sudo sshfs -o ssh_command="ssh -i /backup/ssh_key" user@user.evbackup.com:/home/user /mnt/user.evbackup.com - 3. Test connectivity
-
sudo ls /mnt/user.evbackup.comIf you are successful, then you should see something like the following:
backup-1 backup-2 backup-3 backup-4
backup-5 backup-6 backup-7 backup-8
Yes, that's all there is to it. However, sometimes things don't go as planned, so if you need some help, just ask:
SSHFS: Neat Tricks
- Unmounting a Directory
- To unmount an SSHFS mounted directory:
-
sudo fusermount -u /mnt/user.evbackup.com - Mounting your EVBackup account read-only
- Most tutorials covering rsync snapshots strongly suggest that public access to the remote filesystem be read-only. To mount your EVBackup account read-only:
-
Note: the following needs to be entered on one line
sudo sshfs -o ro -o ssh_command="ssh -i /backup/ssh_key" user@user.evbackup.com:/home/user /mnt/user.evbackup.com - Mounting SSHFS within /etc/fstab
- If you would like to mount your account automatically, then you'll need an entry in /etc/fstab
-
sshfs user@user.evbackup.com:/home/user /mnt/user.evbackup.com fuse ro 0 0 - Adding your key to ssh-agent
- If you would like to be able to mount (as well as login over SSH) your EVBackup account without having to specify the path to your SSH key each time, then you'll want to use ssh-agent.
-
ssh-agentsudo ssh-add /backup/ssh_key - In some cases, you may need to create a ~/.ssh/config file. Note that if you do this for the superuser (via sudo), then the path will be /root/.ssh/config. Here is what the contents of the file need to be:
-
host user.evbackup.com
User username
Hostname user.evbackup.com
PreferredAuthentications publickey
IdentityFile /backup/ssh_key - Once you've saved the ~/.ssh/config file, make sure it has restrictive options -- otherwise SSH will ignore it.
-
sudo chmod 700 ~/.ssh/config - Finally, test that you can login — without a password or without specifying a key:
-
ssh user@user.evbackup.com