Obsecurities.com - Security through obsecurity
You are here: Home Guides
JoomlaWatch Stats 1.2.9 by Matej Koval
Guides
Ubuntu Backup With Unison and sshfs

Ubuntu Backup With Unison and sshfs

by Jordan Emmorey

v0.1 This work is licensed under a Creative Commons License.

0. TOC and Purpose
1. Background
2. Use
3. Resources
4. Contact
5. Keywords
6. Disclaimer

0. TOC and Purpose

The purpose of this is paper is to document howto configure backups on a Ubuntu desktop/server using Unison and sshfs.

1. Background

I have a hosting account with Dreamhost, they do a bang up job for a discount webhosting company and I would highly recommend them. That being said, I like to take matters into my own hands when it comes to backing up my data. I had ssh keys already setup for web development and testing, and used sshfs to mount my dreamhost home directory on my local Ubuntu desktop. I have a pair of 500GB SATA drives which I use for backing up my data.

For this example, we will attempt to backup from test.example.org:/home/jemmorey/backup to my local desktop at /home/jemmorey/mnt/backup/.  I will mount my remote home directory via sshfs at /home/jemmorey/otherHomeDir.

2. Use

First step to backing up with Unison via sshfs is to set up ssh keys between the two servers.

Enter file in which to save the key (/home/jemmorey/.ssh/id_dsa): 
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/jemmorey/.ssh/id_dsa.
Your public key has been saved in /home/jemmorey/.ssh/id_dsa.pub.
The key fingerprint is:
8a:bd:68:78:08:28:ef:6d:85:75:95:8a:58:6b:63:03 jemmorey@lappy
The key's randomart image is:
+--[ DSA 1024]----+
| . |
| E . o |
| + o o |
| . O o |
|. = +S |
|+ .o.. |
|.o o..o |
| +.+. . |
| ..+o . |
+-----------------+

Then you should move the id_dsa.pub out of your .ssh directory, and then scp the file to the server you want to mount via sshfs.

scp ~/.ssh/id_dsa.pub 
  This e-mail address is being protected from spambots. You need JavaScript enabled to view it
 :~/.ssh/authorized_keys

Test this via ssh:

jemmorey@lappy:~$ ssh 
  This e-mail address is being protected from spambots. You need JavaScript enabled to view it
  id
id=xxxxxx(jemmorey) gid=xxxxxxx(xxxxxxxx)

If you see your uid/gid of the remote host, then you are ready to mount via sshfs.  To mount, you first need to create the local location you want to mount the remote directory.

mkdir /home/jemmorey/otherHomeDir
sshfs 
  This e-mail address is being protected from spambots. You need JavaScript enabled to view it
 :/home/jemmorey /home/jemmorey/otherHomeDir

Then we can work on unison and getting our files backed up.

sudo apt-get install unison unison-gtk
jemmorey@lappy:~$ which unison
/usr/bin/unison

Now we are ready to craft our backup policy:

jemmorey@lappy:~/.unison$ cat default.prf 
# Unison preferences file
root = /home/jemmorey/otherHomeDir/backup
root = /mnt/backup

With the backup policy in place, we can start unison and backup our files:

unison default.prf 

3. Resources

4. Contact

Thanks for reading. If you have any comments, suggestions or gripes please feel free to send them along. I'm always hungry for feedback. Thanks. Contact me via email at This e-mail address is being protected from spambots. You need JavaScript enabled to view it .

5. Keywords

unison, backup, , remote, backups, ssfsh, Linux, Ubuntu, server, desktop, 9.10, 9.04, karmic, sshd

6. Disclaimer

Obsecurities is furnishing this item "as is". Obsecurities does not provide any warranty of the item whatsoever, whether express, implied, or statutory, including, but not limited to, any warranty of merchantability or fitness for a particular purpose or any warranty that the contents of the item will be error-free.

In no respect shall obsecurities incur any liability for any damages, including, but limited to, direct, indirect, special, or consequential damages arising out of, resulting from, or any way connected to the use of the item, whether or not based upon warranty, contract, tort, or otherwise; whether or not injury was sustained by persons or property or otherwise; and whether or not loss was sustained from, or arose out of, the results of, the item, or any services that may be provided by Obsecurities.

 
<< Start < Prev 1 2 3 4 5 Next > End >>

Page 1 of 5