Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

We have an SSH server that acts as an entry point to our other servers.
Once I login here via ssh, it'll prompt me to key in what server, port,
username, and password that I will be using.

Is there a way that a shell script can fill in those prompts for me?

share|improve this question
1  
Are you using a Wii? Please provide more information about your OS... :) –  Tom Wijsman Apr 3 '12 at 8:02

2 Answers 2

up vote 1 down vote accepted

You MUST NOT put your password in a script, use public key authentication mixed with ssh-agent-forwarding to achieve what you want, it was created to alleviate the need for a password even if you "traverse" many ssh servers.
For the cost of a mere ssh-copy-id to all the servers you will be able to connect from/to any of them.

Here is a guide to setup Agent Forwarding: http://unixwiz.net/techtips/ssh-agent-forwarding.html

edit: The part you're looking for is the one named "Public Key Access with Agent Forwarding" (sorry, no anchors in the article) but you should read the page fully because it presents all the modes of authentication supported by SSH and the last part builds on the former ones.

share|improve this answer
    
What part of the guide does he have to follow? Could you include the essential part in your answer? –  Tom Wijsman Apr 3 '12 at 8:04
1  
I think it's the one with "Public Key Access with Agent Forwarding". However, problem is, I am being prompted to fill in the access details to the next server right off the bat. How can I create ssh keys on the ssh central like that? –  cr8ivecodesmith Apr 3 '12 at 8:20

As stated public key is preferable. But some institutions INSIST on username password.

For this you can use the utility expect. An example to use it with ssh is here.

Just make sure the password is properly guarded agains prying eyes ;)

share|improve this answer

Your Answer

 
discard

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.