Home / How to avoid password prompt input with rsync?

How to avoid password prompt input with rsync?

You are given a password input prompt when transferring files to a different server with rsync.

$ rsync -avz /data root@srv::files
Password:

There are two ways to use the RSYNC_PASSWORD environment variable and the --password-file option.

Using the environment variable

$ export RSYNC_PASSWORD=secret

$ rsync -avz /data root@srv::files

or

$ RSYNC_PASSWORD=secret rsync -avz /data root@srv::files

Using the command option

$ echo Passw0rd > user2.secret
$ chmod 600 user2.secret
$ rsync -avz --password-file user2.secret /data root@srv::files

Purchase Dedicated Servers

Select, configure, and buy!

Leave a Reply