04-06-2009 01:44 PM
I have IOS using ssh V.2 and CatOS using SSH v.1 and I have perl cgi- ssh expect script to remote access those 2 switch. however, I am able to access the IOS switch but not the CatOs. anybody knows how can alter my script to handle both version or this not achievable.any help highly appreciated.
Solved! Go to Solution.
04-07-2009 10:10 AM
"term len 0" is not valid for CatOS. The equivalent command is "set length 0".
04-06-2009 03:44 PM
As long as your SSH client supports both versions of the protocol, no changes to expect is required. OpenSSH supports both protocols.
04-06-2009 04:17 PM
just a wild guess on my part but when you ssh to the CatOS from the client where you initiate the perl-expect script, did you use something "spawn ssh -1 -l $username $remotehost". I have not used ssh on CatOS that much but I don't think CatOS support ssh version 2. Most unix ssh client default to version 2. That could be the issue.
04-07-2009 06:28 AM
Thanks a lot for your response!I am using "spawn ssh -l $username $remotehost" not using force version -1 since the other switch using version 2.unfortunately all our CatOS using version 1.I have enabled both Version 1 and 2 on my unix server but still the expect script unable access the CatOS switch.
04-07-2009 06:39 AM
04-07-2009 09:04 AM
If you're using OpenSSH, protocol version 1 will print:
RSA1 key fingerprint ...
So you'll need to modify your regular expression:
expect {
-re "RSA1? key fingerprint" {send "yes\r"}
timeout {puts "RSA error -> $expect_out(buffer)";exit}
}
Of course, you didn't mention the specific error you're seeing, so it's impossible to know if this is the only problem (or a problem at all).
04-07-2009 10:04 AM
thanks J. we are close too. after added as you suggested to expect RSA1" now the error I got is
"term len 0
Unknown command "term". Use 'help' for more info." so when add a comment on this line on my expect script
#expect {
-re "\[#>] ?$" {send "term len 0\r"}
timeout {puts "error reading prompt -> $expect_out(buffer)";exit}
}
my script able to access the switch but display only the the banner section when I run a script " as you know this CatOs display first the banner before going to device prompt. so it's hang on banner portion not going to actual switch123> (enable).
Thanks
04-07-2009 10:10 AM
"term len 0" is not valid for CatOS. The equivalent command is "set length 0".
04-07-2009 10:14 AM
working perfectly.....thank you so very much!!!!!!
Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: