Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
594 views
in Technique[技术] by (71.8m points)

cygwin rsync works, but not when sshpass is used

I'm using cygwin with openssh, openssl, sshpass, and rsync installed, among others. I've added C:cygwin64home to the environment variable "path". When I run the command rsync -avP [email protected]:/remote/path/ . elativelocalpath it works. However, if I use sshpass, like so:

set SSHPASS=password
sshpass -e -v rsync -avP [email protected]:/remote/path/ .
elativelocalpath

this does not work. The files are not transfered, and the output is:

SSHPASS searching for password prompt using match "assword"
[email protected]'s password:
SSHPASS detected prompt. Sending password.
SSHPASS read:

Nothing appears after "SSHPASS read:". Also I replaced the real remote username and IP address by "user" and "1.2.3.4" when showing this information here. The real password contains special characters that need to be escaped when run from a batch script. However, I don't think this is the issue since I don't get a wrong password error (which I can get if I set SSHPASS to the wrong password)

The local computer is on Windows 10, while the remote is on Ubuntu. I usually connect to it via putty.

So my question is, what do I have to do to get rsync to work without requesting a password each time I run it? I cannot change the configuration of the remote computer.

This might be unrelated, but the rsync command only works if the local path is a relative one, otherwise we get an error saying they can't both be remote. This was on a stachoverflow answer.

Also, rsync was refusing to add the host to the list of known hosts, until I edited the file nsswitch.conf to include the line db_home: windows.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...