On Friday 25 January 2008 08:37:24 am Ken Schneider wrote:
> Carlos E. R. pecked at the keyboard and wrote:
> > Hi,
> >
> > I want to enter an ssh session without having to type the password (to
> > be used by a script). The "remote" is a router with embedded, and it is
> > not possible to create public key pairs because it is not a shell, but
> > one with a limited command set.
> >
> > I can give the user, like:
> >
> > ssh [EMAIL PROTECTED]
> >
> > but I haven't found a way in the man to give also the password, as there
> > is for instance in ftp.
> >
> > I think there is something like chat ? but I'v never used it and I'm
> > unsure how.
> >
> >
> > If any one is worried about security, don't: for instance, if you use
> > subversion with ssh access (to Novell, for instance) the password is
> > stored in clear text in ~/.subversion/auth, and the file is world
> > readable! (Was, rather, I changed it). So subversion must be giving the
> > password somehow.
> >
> > -- Cheers,
> >        Carlos Robinson
>
> Try using expect to do what you want. I used expect when connecting to
> Cisco routers to do configuration changes with the password embedde3d in
> the expect script.
>
> --
> Ken Schneider
> SuSe since Version 5.2, June 1998

You should obviously read the man page, but if you want to start having fun 
right away, paste the below script into a file, change the name, host, and 
password to fit your environment and run it with:

expect FileYouSaved

Here is the script:

#!/usr/bin/expect
spawn ssh -l UserNameHere 192.168.1.111
expect Password:
send "PassWord\n"
interact


Note:  You need the \n at the end of your password.
-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to