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 passwo
Alternatively you could let ssh collect the password via X11 using the SSH_ASKPASS environment variable.
From the man page:
> SSH_ASKPASS
> If ssh needs a passphrase, it will read the passphrase from the
> current terminal if it was run from a terminal. If ssh does not
> have a terminal associated with it but DISPLAY and SSH_ASKPASS
> are set, it will execute the program specified by SSH_ASKPASS
> and open an X11 window to read the passphrase. This is particularly
> useful when calling ssh from a .xsession or related script.
> (Note that on some machines it may be necessary to redirect the
> input from /dev/null to make this work.)