IDNetters Forums

Technical News & Discussion => Unix/Linux News & Discussion => Topic started by: psp83 on Jan 05, 2012, 08:25:48

Title: RSYNC
Post by: psp83 on Jan 05, 2012, 08:25:48
Does anyone know much about RSYNC ?

I'm looking at writing a script that puts selected files/folders to a live site from a UAT server.

So it will be linux to linux via SSH.
Title: Re: RSYNC
Post by: jameshurrell on Jan 10, 2012, 21:41:05
Have a look here: http://www.mikerubel.org/computers/rsync_snapshots/#Rsync. I managed to use it to get something to work to back up from my Linux VPS to my local QNAP NAS... took a bit of effort but with cron it works well.

For local to remote, something like:

rsync -a -e ssh source/ username@remotemachine.com:/path/to/destination/
Title: Re: RSYNC
Post by: psp83 on Jan 10, 2012, 22:13:23
I use the following

rsync -avzx --progress /home/username/public_html/ user@example.com:/home/username/public_html/

You don't need to use -e ssh as rsync works over ssh by default.

The issue I am getting now is that the server is asking for the passphrase everytime even though keys are generated and on the correct side.

On the UAT server the following was ran :


ssh-keygen
ssh-copy-id user@example.com


Everything has been added to ssh-agent as well. But when I run the rsync command I get asked for the passphrase.
Title: Re: RSYNC
Post by: Steve on Jan 10, 2012, 22:54:03
Paul have a read through this.- http://troy.jdmz.net/rsync/index.html it's fairly logical and comprehensive I hope it's applicable - note the file permissions I was wondering if that was relevant if your stored keys weren't accessible.
Title: Re: RSYNC
Post by: psp83 on Jan 10, 2012, 23:34:30
Hi Steve,

Thanks for the link. I just checked and the permissions of the keys are correct and the .sh script I'm running is correct at 700.

I've also looked at the authorized_keys file and the correct information is there.

Its a weird issue and I guess the hosts will have to look into it as its acting like the agent id is changing every time the script is ran so it's re asking for the passphrase.
Title: Re: RSYNC
Post by: nowster on Jan 11, 2012, 11:42:10
Quote from: psp83 on Jan 10, 2012, 22:13:23
Everything has been added to ssh-agent as well. But when I run the rsync command I get asked for the passphrase.
Did you run ssh-add?
Title: Re: RSYNC
Post by: psp83 on Jan 11, 2012, 11:45:14
Quote from: nowster on Jan 11, 2012, 11:42:10
Did you run ssh-add?

Yep
Title: Re: RSYNC
Post by: nowster on Jan 11, 2012, 16:39:18
Try ssh -v user@hostname and see what's failing.

If everything's working, you should see within the debug output something like:

debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Offering DSA public key: /home/user/.ssh/id_dsa
debug1: Server accepts key: pkalg ssh-dss blen 434
debug1: Enabling compression at level 6.
debug1: Authentication succeeded (publickey).