my target is to copy /tmp/my_file from to my Linux machine without login and password , I set the passwords file with the right password - secret123 so rsync should work , please advice why I get Permission denied.

Remark - address is linux machine version – red hat 5.3

   rsync -WavH --password-file=/tmp/passwords --progress root@ .

   Permission denied.
   rsync: connection unexpectedly closed (0 bytes read so far)
   rsync error: error in rsync protocol data stream (code 12) at io.c(165)

   more /tmp/passwords

   ls -ltr  passwords
   -rwxr-xr-x    1 root     root           10 Sep 12 17:32 passwords

It looks like you may be using SSH to connect to root. SSH usually doesn't allow logins to root, and many distributions don't allow root logins at all. You might be better off using an SSH authorized key to enable you to connect as root.

It would be better to connect to an account other than root if you can.

If you want to use an rsync deamon on the remote end I believe you need two colons after the server specification. Rsync user ids are not the same as system user ids. Access is controled by the rsync configuration file.

EDIT: If you are using an rsyncd deamon on then either of these should work. (NOTE: I changed the user id, try to avoid using root.) I also assume you have a tmp module mapping to /tmp.

rsync -WavH --password-file=/tmp/passwords --progress rsync@ .
rsync -WavH --password-file=/tmp/passwords --progress rsyncd://rsync@ .

Verify you can connect to the daemon process with the command telnet 873 which should return an RSYNC version. You can also test using rsync with the command rsync which should return a list of public shares. Add your userid and password file to the command to get private shared.

If, as it appear,s you are using ssh, use a private key. You can use ssh-agent and ssh-add to load the key so you don't need to enter the password. Again don't use root unless you must. It would be better to give access to the file using a different group, and setup a userid with access to that group.

You can test ssh access with ssh. If the file is always new when you want to copy it, then scp would be simpler than rsync.

Try testing access without a copy option. Something like this should work:

rsync -vvv --password-file=/tmp/passwords rsync@

EDIT2: I re-read your query. It appears you want to copy a single file without login. The easiest approach would be to use scp with am authorized key file on the remote system. Few files are only readable by root, so you should be able to use a different user id. Try a command like:

scp user@ . 

The only advantage to using rsync is to avoid copying the file if it hasn't been replaced. Because you use the -W option, you loose the advantage of only transferring changes. For log files the --append option can be helpful in speeding up transfers.

  • about "two colons after the server specification." please give me example of the right syntax (what I need to fix in my syntax?) – Diana Nov 13 '11 at 16:02

--password-file option can be used only when connecting to a rsync server.

You have to use rsync over ssh with key authentication in order to work.

-password-file This option allows you to provide a password in a file for accessing an rsync daemon.

from: rsync man page


The simplest way would be to setup SSH keys and use these to establish your rsync connection.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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