ssh command execution

Unanswered Question
Mar 13th, 2007

Is there a way to execute commands on a cisco device by giving only one ssh command from a computer?

I have this problem too.
0 votes
  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 4 (1 ratings)
Loading.
ggilbert Tue, 03/13/2007 - 09:11

Hi,

Can you please explain to me what you are trying to do.

Normally SSH is used to get management access to the device.

Do you want to do something after that?

Thanks

Gilbert

MZydorczyk2 Wed, 03/14/2007 - 08:12

Yes. I want to be able to execute commands on the device from the computer by only having to type one command. I dont want to have to login and then configure the device.

For instance:

ssh -l -v "sh ver"

at the computer would connect to the device, ask for the password and execute the command all in that one command. However I can only get it to take one command. Is there a way to like run a list of commands you want to execute on the device? Or is there something else I could do to automate the ssh session?

hoogen_82 Tue, 03/13/2007 - 11:42

First your router should support ssh function. For this make sure you IOS shows a k9 in it. Or else download a suitable one.

Then generate the crypto rsa keys on the router/device. crypto key generate rsa. Specify if neccessary the ip ssh authentication retries and timeout seconds.

Leter download a software like putty or secure crt to connect to these devices from your PC.

HTH

Hoogen

MZydorczyk2 Wed, 03/14/2007 - 08:21

This is for any cisco device not routers in particular. Also I know how to setup and use ssh but I want a way to automate it. Like i mentioned in the other reply above

ggilbert Wed, 03/14/2007 - 08:39

Hi Matthew,

I understand what you are saying - To be honest with you, I do not know if an SSH single line entry is there to automate such a process you are requesting...

But there is an option in IOS called as "Embedded Event Manager" (EEM) -

Please take a look at it. See if this is something that would help you out.

http://www.cisco.com/en/US/products/sw/iosswrel/ps5207/products_command_reference_chapter09186a00801a8085.html

Cheers

Gilbert

Note: I had never used it before but playing around with it might help or atleast give you an idea. Sorry for not giving you a direct answer.

Actions

This Discussion