Cisco Support Community
Showing results for 
Search instead for 
Did you mean: 

Attention: The Community will be in read-only mode on 12/14/2017 from 12:00 am pacific to 11:30 am.

During this time you will only be able to see content. Other interactions such as posting, replying to questions, or marking content as helpful will be disabled for few hours.

We apologize for the inconvenience while we perform important updates to the Community.

New Member

ssh command execution

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

Cisco Employee

Re: ssh command execution


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?



New Member

Re: ssh command execution

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?


Re: ssh command execution

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.



New Member

Re: ssh command execution

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

Cisco Employee

Re: ssh command execution

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.



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.

CreatePlease to create content