Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

The situation is our client wants to download the most recent backup from our server (and they don't want us setting it up for them via rdesktop etc.. (sigh)). The client is running windows, server is linux.

I don't want to have to write a lengthy and complicated guide for them to set up pub/pri key auth as they'll no doubt waste all their time and ours. I'm going to get them to install cwRsync which is just rsync for windows pretty much.

Normally I'd use a public/private key setup to do this and set it up securely, however that's not really too much of a concern.

How do I specify a password for ssh on the command line for rsync? I'm used to: rsync -avz someone@somehost:/blah .

Cheers, John

share|improve this question
    
Hmm, seems like there's no easy way to do it.. I guess I'll just create a couple of keys. –  John Hunt Mar 9 '11 at 0:34

2 Answers 2

up vote 3 down vote accepted

How do I specify a password for ssh on the command line for rsync?

The short answer is that you can't. SSH is designed to prevent you from doing this. cwRsync is a extremely stripped down cygwin install that has only ssh/rsync. The tools you might use instead like sshpass or expect won't be present.

I really doubt you'll save any time trying to get them to use a password given the above limitations.

It is generally a bad idea, but if you have a secure communications method between you and them, you might consider just generating the key-pair for them, and then transmitting the private key to them. It doesn't seem like it would be that much worse then enabling them to have a password stored in a script/text file somewhere.

share|improve this answer
    
Yeah, it turned out it wasn't that hard to just generate a key pair and use the -i argument to specify the location of the private key. Actually it was much easier than I thought. cwrsync is actually pretty good once you learn some of it's quirks too. –  John Hunt Mar 9 '11 at 6:16

You are not going to be able to do this without an rsync daemon. Trust me, I tried many many times before I went for the key solution (which is by far much easier and more secure). So while there are many options showing that you can do something like this:

rsync -avz -e ssh rsynctest/  username@***.***.***.***:/home/directory/rsynctest --password-file=/home/username/rpass

Do not believe them. Do not waste your time. It will not work just because you have rsync and ssh installed. Until you understand how to make the transfer without ssh (and I wasted my time for a while until I verified that it wasn't easy) and getting a rsync daemon running it'll never work. Here are two really good reads if you still want to try (if you haven't already followed the good advice of Zoredache).

http://everythinglinux.org/rsync/ (let's party like it's 1999 - seriously, that's when it was written)

http://finmath.uchicago.edu/~wilder/Security/rsync/

I dropped my attempts at making that work years ago, went with keys over ssh, and never looked back.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.