[AuckLUG] Automate SSH with a Script

David Hawke David.Hawke at ppfort.net
Fri May 11 15:28:58 NZST 2007


Fuad Tabba wrote:
> Hi,
>
> I was wondering if anyone knows how I could automate SSH logins so 
> that it
> would read the password somehow from stdin or a file. I need it to 
> automate
> logging in and running scripts on a bunch of machines. I know and did
> perform it by generating and exchanging keys, and that works fine. The
> problem is, every so often I need to run these scripts on different 
> machines
> and I don't want to go through the hassle of doing that over again.
>
> I also know that this kind of thing can be done using Expect scripts, 
> so if
> Expect can do it then I guess there would be a way for me to do it...

Can you use a here document - ie
ssh user at some.system <<-EOF
passwordgoeshere
first command
secondcommand
EOF

??

David H
>
> Any ideas?
>
> Cheers,
> /Fuad
> _______________________________________________
> AuckLUG mailing list
> AuckLUG at linux.net.nz
> http://www.linux.net.nz/cgi-bin/mailman/listinfo/aucklug
>
> !DSPAM:4643e30c80553936241041!
>




More information about the AuckLUG mailing list