User:Ixo/Script/get-xo
(These are starting notes for a new wiki page on a possible solution for backing up a XO Laptop to a server. I needed to develop a solution for my own situation, so I might as well document and share it for others. :)
Intro
Summary
- get-xo: Get a local copy/backup of your XO Laptop /home directory.
- one of many methods to 'backup' a laptop 'important' (Really? which ones?) files onto a central server.
Description
- From server (or any other computer), backup and copy files from XO Laptop.
- Script can ran multiple times, will only copy over files which have changed.
Benefits
- Creates a backup of /home/olpc in case of errors or mistaken deletions.
- Allows examination of files on different machine, with better local tools and resources.
- run between operations on the XO, to see files created or updated.
As of Jan 7th, 2008, the below is theory, since currently:
- the default XO/ssh keys are 2048 bits long (instead of typical 1024, not sure if this is a problem)
- Can't seem to get the 'enter password' prompt to go away during ssh.
- Still investigating options for ssh and ssh-keygen.
SETUP
Step 1. SERVER
(i.e. who's going to grab a backup copy?)
- Create a new unique user for just preforming the backups (i.e. laptopbu )
- Logon as the new user
- create new 'ssh security' keys for your account. (See either method #1, or #2)
- Copy your 'SERVER ssh public key'.
- Put file onto Laptop.
Step 2. XO Laptop
(i.e. what device to backup.)
- Using Terminal or root shell' logon as olpc.
- Create new file ~olpc/.ssh/authorized_keys
- Copy into above file, your copy of 'SERVER ssh public key' (see above),
Step 3. SERVER
(i.e. who's going to grab a backup copy?)
#!/usr/bin/bash #### FILE: get-ixo ######## # 2008 01 12, Iain D, ixo AT myna DOT ws ## RELEASED under CC-BY-SA-NC 3.0 license. $ rsync --verbose --progress --times --perms --recursive --compress --links \ --backup --rsh="ssh" olpc@192.168.0.12:/home /home/OLPC-BACKUP/USERNAME
NOTES:
- Command is one single line.
- Must setup password for olpc account, via 'root' command of $ sudo passwd olpc .
- 192.168.0.12 is the IP address of the OLPC XO Laptop.
- /home/OLPC-BACKUP is local directory on server for the backup
Where 192.168.0.12 is the IP address of the laptop you are backing up.
Outstanding Questions
- Is there an easy way of moving the ssh public key from SERVER to LAPTOP ?
- USB Drive ?
- Download via Webpage ?
- Best method for figuring out unique IP address for the LAPTOP needing to be backed up?
- Via Webpage, log to specific file for rsync to use ?
- Type manually ?
- Best method for uniquely identifying the LAPTOP needing to be backed up ? (use Serial Number ?)
- Is it possible for IP address to change between connection attempts?
- Archive how many copies of files? only one copy? or multiple ? Limited ?
- Rsync has some of these options built in.
Background details
1. Create SERVER ssh keys with either of the following methods
$ ssh-keygen (pass phase can be blank, generates id_rsa and id_rsa.pub ) (need exact steps here.. )
2. Your 'SERVER' ssh public key ( ~/.ssh/id_rsa.pub ) looks something like this.
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEAyf/ux1DcURj7dyeHMPFk/zafEnuCOqJVWCb1Sy12ksEkfzoWojL1mcjXNnkfZ+P10SOlQ5kjerH7 2JBu4DqPP3NUrcuFezhST9Ixa3NU1ts1w2VKHAcAcSAq8ayBmVGzrTxq7gayT5RSvo/nvI0TXJHSSF3Jh/7hSFAKED4YOURUSE wiki@laptop.0rg
3. Your 'SERVER' ssh private key ( ~/.ssh/id_rsa ) looks something like this.
-----BEGIN RSA PRIVATE KEY----- MIICWwIBAAKBgQDJ/+7HUNxRGPt3J4cw8WT/Np8Se4I6olVYJvVLLXaSwSR/Ohai qMvWZyNc2eR9n4/XRI6VDmSN6sfvYkG7gOo8/c3Oty4V7OFJP0jFrc1TW2zXDZUo cBwBxICrxrIG+UbOtPGruBrJPlFK+j+e8jRNckdJIXcmH/uFJ1HYOMssQwIBIwKB gEVBzjW1Utn579EU3eTlDK9F7WVsLKZjivmm9QPVErX5E9PZZtiu5s0qrQnkTlb0 4NwXgVetKcpB3iYwUQ0WQa3m919JKCriMwrcA7Zqu1bS5Q48Q9v9TgydHxyKAguD xerfe/HBMwLNJ1WpeEFYwHNZi+Y3k2Mpvy8XuDB5yRUrAkEA5S1kceYwXMF3P1ZR Y6B/3Hy1KH5vn4YIZi5cfbHQZ2B/cK2Ak4NXERQR5sKCn1Kc7yG+fY846iLU7W2G avSlbQJBAOGkPwU9aHxgR6jnoD2Ka5fUDbVQzIMc/z63kWEk6b2Pt43FVLEX/1bf 1I/eXbqwYBNNgIHPYVFrEYoLGb/3+m8CQHxpGUUlMDJaZU5EzRjTeJxDsszW7CNm BI89vS5KlbR2No2gA/hOnPqkfr8ZIlZ9TeDmbrkwfftx/o+EmW1C+rcCQQCuEP1q cTNYogtlCnRMuz0OuYbq9TANX4MTH+UtrsLxUZw6KoMph4p2N6P59K60lrCD61SB ZXb1ql38xrwXv0wpAkEA4qsLj1QhcLSZdHuuSyLwjovqVzPB+PKJs/c+JDO0Nr6b DYjugZ9YtVNLd5JEQHSkYI+TLGrCCFAKED4YOURUSE== -----END RSA PRIVATE KEY-----
4. Your 'LAPTOP' authorized_keys ( ~olpc/.ssh/authorized_keys ) looks something like this.
- (Note: Final configuration, this file should be the same as ssh public key)
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEAyf/ux1DcURj7dyeHMPFk/zafEnuCOqJVWCb1Sy12ksEkfzoWojL1mcjXNnkfZ+P10SOlQ5kjerH7 2JBu4DqPP3NUrcuFezhST9Ixa3NU1ts1w2VKHAcAcSAq8ayBmVGzrTxq7gayT5RSvo/nvI0TXJHSSF3Jh/7hSFAKED4YOURUSE wiki@laptop.0rg
5. See 'rsync --help' or 'man rsync' for full explanation of options.
6. See 'ssh --help' or 'man ssh' for full explanation of options.