[AuckLUG] Automate SSH with a Script
Fuad Tabba
fuad at cs.auckland.ac.nz
Fri May 11 16:25:57 NZST 2007
Minor correction - thanks to everyone but especially Martin :) That was the
solution I was looking for...
/Fuad
On 5/11/07, Fuad Tabba <fuad at cs.auckland.ac.nz> wrote:
>
> Thanks Michael, that's exactly what I've been looking for.
>
> As for exchanging keys, that's a hassle in my case since as I mentioned, I
> have a cluster of over 20 machines I need to automate the connection to -
> and I could run my scripts that do my automation from a bunch of different
> machines as well. Setting up the keys for all of those would be quiet a
> hassle.
>
> An easy way to do it would be using an Expect script. I actually wrote
> this short script below to do it - the problem with that solution is that
> I'm too lazy to install Expect or to expect* it to installed on all the
> machines I want to run from. (no pun intended :) )
>
> Anyway, my Expect script in case any one is interested, called ssh.exp :-
>
> Example: ./ssh.exp user at server.com
>
> ----------------------------
>
> #!/usr/bin/expect -f
> spawn ssh $argv
>
> expect {
> "(yes/no)" {send "yes\n"; exp_continue }
> -nocase "password" {send "topsecret\n" }
> }
> interact
>
>
> On 5/11/07, Martin Bähr <mbaehr at email.archlab.tuwien.ac.at> wrote:
> >
> > On Fri, May 11, 2007 at 03:23:03PM +1200, Fuad Tabba wrote:
> > > 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.
> >
> > try using an SSH_ASKPASS script.
> > i found this page which seems to cover all that you need in your
> > situation:
> > http://www.derkeiler.com/Newsgroups/comp.security.ssh/2005-02/0087.html
> >
> > greetings, martin.
> > --
> > cooperative communication with sTeam - caudium, pike, roxen and
> > unix
> > offering: programming, training and administration - anywhere in the
> > world
> > --
> > pike programmer working in new zealand
> > open-steam.org|webhaven.co.nz
> > unix system- bahai.or.at iaeste.(
> > tuwien.ac|or).at
> > administrator (caudium|gotpike).org
> > is.schon.org
> > Martin Bähr http://www.iaeste.or.at/~mbaehr/<http://www.iaeste.or.at/%7Embaehr/>
> >
>
>
>
>
>
More information about the AuckLUG
mailing list