0

I am trying to make a script in bash that connects via ssh to another machine. I only have user access to this machines so

  • I can't use expect (It is not installed and I can't install it)
  • I can't install ssh keys

So I have to log in via username and password. Is there a way to make my script send my password just using bash?

Nevado
  • 162
  • 7
  • check if you have `pexpect` and `python` ...you can do much better with `pxpect` "if its there". – P.... Nov 28 '17 at 13:43

1 Answers1

0

You can do that with sshpass, however, it's insecure.

sshpass -p YOUR_PW ssh ...

That will connect without asking for password.

You might need to add the flag -oStrictHostKeyChecking=no to ssh for auto-accepting keys.

ntj
  • 171
  • 12