How can I make an expect script prompt for a password?

Posted by MiniQuark on Stack Overflow See other posts from Stack Overflow or by MiniQuark
Published on 2009-03-25T14:47:35Z Indexed on 2010/06/11 18:52 UTC
Read the original article Hit count: 253

Filed under:
|
|

I have an expect script that connects to a few routers through ssh. All these routers have the same password (I know, it's wrong), and the script needs to know that password in order to be able to connect to the routers. Currently, the password is passed to my script as an argument on the command line, but this means that there's a trace of that password in my .bash_history file as well as in the running processes. So instead I would like the user to be prompted for a password, if possible silently.

Do you know whether or not it's possible to prompt the user for a password with expect?

Thank you.

Edit: if I was connecting to servers instead of routers, I would probably use ssh keys instead of passwords. But the routers I'm using just support passwords.

© Stack Overflow or respective owner

Related posts about password

Related posts about prompt