Some SSH & RSYNC help

| |

Hey everyone,

I am in need of a little help or a point in the right direction with some SSH & RSYNC stuff I'm trying.

Using CentOS 5 I am trying to automate some rsync tasks through ssh. I have CentOS5 on the destination too. I have a DSA and RSA key generated and scp'd onto the destination server. Essentially I am trying to do a host authentication to get around the password. The destination server is a production system so I can't lax much on the security or this would be much easier.

I have been trying to use some instruction from the rsync site as well as linuxquestions but I'm not making any real headway. The usernames are different for the source and destination systems but that shouldn't really matter for RSA/DSA authentication, should it?

Any help or refernces you could give me would be hot!

On another note, eventually I'll get to one of the LUG meetings. At least this month I made it to MSO but forgot my directions to Sean Kelly's. 8^p


"only the strong of heart can win to the place of the Vision!"


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Quick assist with SSH

Hey, so I'll make these two assumptions: 1) you have a home PC, and a webserver both running Centos and 2) you are trying to upload stuff from the home PC to the webserver automatically. If you need to change the assumptions do so as you please.

So, we have homePC where you login with user arktik and webserver were you login as user webadmin

So, on homePC you run
ssh-keygen -t dsa
It'll save a pair of keys in your ~/.ssh dir; id_dsa and

So upload the public portion to the webserver. Copy it first to authorized_keys though.
cp authorized_keys
scp authorized_keys
You supply your password now.

So, now you have your public key loaded to your webserver, and you should be able to login via keys... but maybe not if you've not fixed your sshd_config in /etc/ssh. You need to have a line similar to:
PubkeyAuthentication yes
maybe it's publicKeyAuth... I can't recall right now, and don't feel like installing openssh server on my laptop to find out...

anyway, after it's accepting keys, you try logging in like this:

ssh -l webadmin
ssh webadmin@webserver

and then after that's working as expected, you can use rsync the same way:

rsync -avzpog /home/web/projects/mysite webadmin@webserver:/var/www/thesite

anyway, this is from memory.. so there's probably stuff wrong, but it should get you going the right direction. Keep in mind your trailing slashes or lack thereof with rsync.

have fun!

Scott Dowdle's picture

What error do you get?

What error message do you get?

Since you have two different users... you need to make sure that the key is stored in the appropriate place: ~/.ssh/authorized_keys2 on both ends.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.