linux - Pass a password to ssh in pure bash -
i want pass password ssh
using bash script (yes, know there ssh keys use, not intend).
i found solutions using expect
since not standard bash tool wondering if can using pipes.
can explain me, why this:
echo "password\n" | ssh somehost.com
or
ssh somehost.com <(echo "password\n")
doesn't work? there possibility make work? maybe executing ssh
different process, obtaining pid , sending string directly it?
you can not specify password command line can either using ssh keys or using sshpass
suggested john c. or using expect
script.
to use sshpass, need install first. then
sshpass -f <(printf '%s\n' your_password) ssh user@hostname
instead of using sshpass -p your_password
. mentioned charles duffy
in comments, safer supply password file or variable instead of command line.
Comments
Post a Comment