Posts Tagged by Expect
rsyncp – provide ssh password to rsync using expect
| 28-Jul-2011 | Posted by Sonia Hamilton under Expect, Rsync, Ssh |
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
#!/usr/bin/expect
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/ done
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 <sigh>
expect notes
| 14-Nov-2007 | Posted by Sonia Hamilton under Expect, Perl |
Recent Comments
<<EOF>>was eaten...cat <>~/.vi...