views:

496

answers:

2

How can you make SSH read the password from stdin, which it doesn't do by default?

+1  A: 

FreeBSD mailing list recommends the expect library.

If you need a programmatic ssh login, you really ought to be using public key logins, however -- obviously there are a lot fewer security holes this way as compared to using an external library to pass a password through stdin.

Mark Rushakoff
+1  A: 

You can't with most SSH clients. You can work around it with by using SSH API's, like Paramiko for Python. Be careful not to overrule all security policies.

lbp