Dedors’s Weblog

19. Juli 2008

Howto: rsync SSH Configuration for backuppc

Filed under: Linux — dedors @ 00:32
Tags: , , ,

It’s a little diffrent from normal SSH connection, so i post it as stand-alone howto. I use here [LAPTOPUSER] as client username, and has to be replaced in the commands.

Server-Side:
Generate a public/private key on the server machine in /home/backuppc/.ssh/laptop & Generate a public/private key on the client machine in /home/$USER/.ssh/laptop. Replace [LAPTOPUSER]

sudo su backuppc
cd ~
ssh-keygen -t dsa -f ~/.ssh/laptop2
scp ~/.ssh/laptop2.pub [LAPTOPUSER]@192.168.0.11:~/

Create the folder ‘.ssh’ if it doesn’t exist and configure the public key to OpenSSH’s liking. Replace [LAPTOPUSER]

ssh [LAPTOPUSER]@192.168.0.11
if [ ! -d .ssh ]; then mkdir .ssh ; chmod 700 .ssh ; fi ; mv laptop2.pub .ssh/ ; cd .ssh/ ; if [ ! -f authorized_keys ]; then touch authorized_keys ; chmod 600 authorized_keys ; fi ; cat laptop2.pub >> authorized_keys ; rm laptop2.pub;
exit

Test if you can connect without being prompted for a password, but you should have to enter the passphrase

ssh -i ~/.ssh/laptop2 [LAPTOPUSER]@192.168.0.11

Manually Rsync via SSH

rsync -avrz   $USER@laptop:/home/$USER/ -i ~/.ssh/laptop2

Now you need the ssh-agent,

ssh-add laptop2

but you will propably get the following error (with user backuppc):

Could not open a connection to your authentication agent.

then just use this command:

eval `ssh-agent`

Edit backuppc settings:

type: rsync
rsyncclientcmd: replace root with [LAPTOPUSERNAME] and add -i ~/.ssh/laptop2

that should work and backup with your clients username

Bloggen auf WordPress.com.