Go to ...

Techpository

A Better Technical Repository

RSS Feed

Linux: Passing a password with rsync using expect


Using ssh keys is always one of the safest ways to connect rsync through ssh.
Here is an alternate less secure way to use rsync when in a pinch.

Install expect

Run the following command:

expect -c ‘spawn rsync -e ssh -avz [email protected]:/pathonremoteserver/directory /localdirectory; expect “*?assword:*” {send “userpasswordr”; interact};’