Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to get the output of some 'show' commands in linux and print them in a file
It's a HP 2626 switch
1. How can i setup Passwordless entry via public key authentication to the switch
2. How can i make a bash command to login to the server and then write the output of the switch in a file

*only ssh access is aplicable here

share|improve this question
up vote 2 down vote accepted

First of all, note that the RANCID tool can be used to automate the process of tracking your switch config over time. I haven't used it myself but the docs indicate it works with Procurve switches. I strongly recommend you investigate using it.

Aside from that, your first step is to enable ssh access to the switch and upload your public ssh key. Here's a great howto for doing that.

Once you have ssh access working for the manager or operator account on the device, you will need to use something like expect to automate ssh connections to the machine. This Stack Overflow posting has some great tips on how to do that.

But again, I strongly recommend you try to get RANCID working first, since that's a more standardized way to do this, and will scale better if you have more than one switch, or switches from different vendors.

share|improve this answer

I remember it was tricky but I did get it to work. I think this was the article I used:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.