05-19-2007 04:28 PM
I'm trying to run a script to backup configs from Cisco switches with SSH and I can't seem to run a loop with the username/password saved for the session.
I'm using Teraterm macro at this time.
Anyone has any suggestions or examples? I'll post my config if anyone's interested.
Thanks.
05-19-2007 04:33 PM
I don't have any experience with TeraTerm macros, but I do have expect experience. How do you need to backup the configs (i.e. TFTP, simple screen scrape, etc.)? What switches running what IOS/CatOS?
05-19-2007 04:46 PM
For starters, I'm just trying to backup the configs (sh run, sh ver) from a couple of 6509 switches (IOS 12.2(18)). I'll have about 80-90 devices in a bit.
Another setback is that I don't have admin rights (yeah, I know) and I've only been able to use TeraTerm for scripting so far. I wish Putty had this feature.
Thank you.
05-19-2007 08:28 PM
Here is an expect script that will do what you want. It can be made to work on Windows provided you have expect for Windows (http://expect.nist.gov/) and OpenSSH for Windows (http://sshwindows.sourceforge.net/). It relies on a creds.txt file to exist in %HOME% (you may need to set this variable prior to running the script). For example, if you stick the script in C:\TEMP, create a C:\TEMP\creds.txt with:
username=parklabel
password=parklabel123
enable=enable123
Then:
set HOME=C:\TEMP
expect C:\TEMP\config_backup.exp 10.1.1.1
(Where 10.1.1.1 is the address of the switch).
This will create two files in C:\TEMP: 10.1.1.1.cfg and 10.1.1.1.ver.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide