rsyncp – provide ssh password to rsync using expect

28 Jul 2011

A script I wrote – rsyncp. It allows you to provide a password to rsync over ssh, when you’re unable to use ssh key-based authentication:

% cat ~/bin/rsyncp
eval spawn rsync $argv
expect  "*?assword:" { send "secretstuffr"}
expect eof

You can then use rsyncp in another script, like this:

for h in foo bar ; do
  rsyncp -av --progress srcdir/ $h:dstdir/

And before you add a comment saying use ssh keys or keychain, this is totally insecure, I agree with you! Key based authentication is disabled on the target server, and I’m still trying to resolve the politics around this at my current company, and sshpass seems broken

comments powered by Disqus

  « Previous: Next: »