LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   rsync password-file not working (https://www.linuxquestions.org/questions/slackware-14/rsync-password-file-not-working-212247/)

kmoffat 08-01-2004 04:18 PM

rsync password-file not working
 
I'm trying to rsync my slack10 partition to a debian server using the following script:

#!/bin/sh
mount /mnt/hda11
rsync -auvz --delete --password-file=/root/SlackPasswd --exclude=/mnt/* --exclude=/proc/* root@compaq:/ /mnt/hda11
umount /mnt/hda11

This is a home lan, and the script is run on the debian box. This always asks me for the password. SlackPasswd contains the root password, and is in the /root directory, readable by root. I'd like to put a script in a cron job to do this weekly, but need the password to work.

I've also tried adding "export RSYNC_PASSWORD=" to the script, to no avail; same results.

Anyone do this sort of thing? I've never tried rsync, but the rsync line works outside the script when I enter the password.

rsync -auvz --delete --exclude=/mnt/* --exclude=/proc/* root@compaq:/ /mnt/hda11

compaq is the slack box.

thanks...

osvaldomarques 08-01-2004 08:30 PM

Hi kmoffat,
I was reading the rsync manual and found this text.
Quote:

--password-file
This option allows you to provide a password in a file for accessing a
remote rsync server. Note that this option is only useful when accessing
a rsync server using the built in transport, not when using a remote
shell as the transport. The file must not be world readable. It should
contain just the password as a single line.

Your syntax suggests no use of rsync server and if you run it as root you may not need to specify the password. Of course it will depend on the setting of rsh/ssh between your machines. Please, tell us what remote shell you are using into your home lan.

kmoffat 08-01-2004 11:18 PM

I assume it's the built in protocol, since I didn't specify. I also tried adding -e ssh with no change. I have tried scripts on both the client and the server; same result, always asks for password. I tried running on the server "rsync --daemon" but had a connection protocol failure error. I guess I'll go back to the drawing board and google some more. Must be a basic setup procedure I'm missing.

Odd that rsync works from the command line where I can enter the password, but not from a script. Might be the rsyncd.conf file that I'm messing up. More tomorrow.

osvaldomarques 08-02-2004 01:29 AM

Hi,
Probably the password is being asked by rsh or ssh on the remote machine. By remote machine I want to say the machine you are not sat on. An easy test is enter
Code:

rsh <remote-machine> echo
or
ssh <remote-machine> echo

In both cases, if the immediate answer is a white line, you're ok to run rsync. If it asks for password and shows the white line or displays a message "connection refused" or "permission denied", you have to setup your machines to accept remote commands from the other to work properly. Make these tests and tell me the results.
rsync normally works without any configuration file for general purposes like as you are trying.
The purpose of an rsync server is to work as an ftp server as you can see in www.kernel.org. It is very specific to send always the same set of files. The general purpose serves as a replacement for "rcp" or even "cp" when you are working on the same system.

kmoffat 08-02-2004 06:07 AM

rsh noisy echo
results in nothing, just a flashing cursor on the next line
ssh noisy echo
asks for password, then gives permissiion denied error.

Cedrik 08-02-2004 06:23 AM

You have to copy your ssh public key on Debian like :

On slackware :
ssh-keygen -t rsa
-- type enter (default) after each question even for password, press enter
-- it will generate 2 files : the private key and the public key (id_rsa.pub is your public key)
Then copy the public key to debian :
scp ~/.ssh/id_rsa.pub noisy:.ssh/authorized_keys2

now try ssh noisy

kmoffat 08-02-2004 10:41 PM

That is TOO easy, many thanks. I've been beating my head against the proverbial wall for a couple of days trying to figure this out. Seems I had a big gap in my knowledge.

Thanks again.


All times are GMT -5. The time now is 02:56 PM.