I use keychain for securely caching my ssh key credentials when running scripts from cron.
Here’s how to use keychain with Perl scripts:
Create a wrapper script: source ~/.keychain/hostname-sh run_perl_program.pl
To run a one-off command do:
system("source ~/.keychain/hostname-sh; cmd");
nice tip.
dont forget your soon to be new friend Net::SSH::Expect
you can apt-get it in debian, dont know about ubuntu
libnet-ssh-expect-perl
Comment by Dean Hamstead — 9 June 2009 @ 13:22
Yes I was looking at Net::SSH::Perl too (has better handling of stderr than SSH::Perl) and noticed Net::SSH::Expect. I’m on old fan of Expect, having had to script in the past nasty things like password changes on ‘n’ boxes. Perl integration is nice – not Yet Another Language (TCL) to master.
Comment by Sonia — 9 June 2009 @ 13:38