Prev: nat problem
Next: Logging issue in CiscoSecure ACS 4.2
From: BertieBigBollox on 16 Apr 2008 08:12 Trying to ssh from a Sun Solaris box to a Cisco router and want to use a script to log in automatically without it prompting for a username and password. Looks like you can use ssh -l <username> to specify a username but there doesnt appear to be a way to send the password, so it still prompts for this. I understand that if I was ssh to another unix box I could probably use the 'expects' command and do it this way but I guess its no good for a cisco router. At the moment, I've got a file, called commands.txt which contains the cisco commands. Then my Solaris script runs a command as follows:- ssh -l user < commands.txt So basically, once logged in the cisco commands are run automatically. However, the password is the problem. Anyone know of any way around this?
From: Gary Mills on 16 Apr 2008 08:17 In <dccbbdd7-731d-4295-9250-8aaa853562ca(a)a1g2000hsb.googlegroups.com> "BertieBigBollox(a)gmail.com" <BertieBigBollox(a)gmail.com> writes: >Trying to ssh from a Sun Solaris box to a Cisco router and want to use >a script to log in automatically without it prompting for a username >and password. I use `kermit' for this purpose. All of the scripting, including the ssh password, can be done within a kermit script. -- -Gary Mills- -Unix Support- -U of M Academic Computing and Networking-
From: Doug McIntyre on 16 Apr 2008 09:21 "BertieBigBollox(a)gmail.com" <BertieBigBollox(a)gmail.com> writes: >Trying to ssh from a Sun Solaris box to a Cisco router and want to use >a script to log in automatically without it prompting for a username >and password. >Looks like you can use ssh -l <username> to specify a username but >there doesnt appear to be a way to send the password, so it still >prompts for this. >I understand that if I was ssh to another unix box I could probably >use the 'expects' command and do it this way but I guess its no good >for a cisco router. (expect, not expects) Why not? Same exact thing. Anyway, the tool has already been invented. The easiest thing to do would probably go get the RANCID package and use the clogin script within. Otherwise, the cosi-nms.sf.net area has many tools as well for remote access.
From: rc on 16 Apr 2008 09:40 On Apr 16, 2:12 pm, "BertieBigBol...(a)gmail.com" <BertieBigBol...(a)gmail.com> wrote: > Trying to ssh from a Sun Solaris box to a Cisco router and want to use > a script to log in automatically without it prompting for a username > and password. > If you know some Perl, the Net::Appliance::Session module allows you to do this, plus it has some goodies like changing to "enable" mode without a lot of expect coding and works transparently over a serial, telnet or ssh connection. <http://search.cpan.org/dist/Net-Appliance-Session/> HTH, Christian -- rc at networkz dot ch
From: BertieBigBollox on 17 Apr 2008 04:51
On Apr 16, 2:21 pm, Doug McIntyre <mer...(a)geeks.org> wrote: > "BertieBigBol...(a)gmail.com" <BertieBigBol...(a)gmail.com> writes: > >Trying to ssh from a Sun Solaris box to a Cisco router and want to use > >a script to log in automatically without it prompting for a username > >and password. > >Looks like you can use ssh -l <username> to specify a username but > >there doesnt appear to be a way to send the password, so it still > >prompts for this. > >I understand that if I was ssh to another unix box I could probably > >use the 'expects' command and do it this way but I guess its no good > >for a cisco router. > > (expect, not expects) > Why not? Same exact thing. > OK. I just thought that since I was running ssh, control wouldnt return to the script running this (and thus go on to the next line with the expect statement on until the ssh command was all done and complete? Dont you need to use 'spawn' or something if doing it this way? Is this right? |