Automatically enter SSH password with script

I need to create a script that automatically inputs a password to OpenSSH ssh client.

Let’s say I need to SSH into myname@somehost with the password a1234b.

I’ve already tried…

#~/bin/myssh.sh
ssh myname@somehost
a1234b

…but this does not work.

How can I get this functionality into a script?

23 Answers
23

Leave a Comment