Let There Dragons Be.

Non-Interactive SSH Login on OS X

We can use `sshpass` to automate SSH logins without having to:

  • Set up a key on the host, or
  • Type in the password

But you try to `brew install sshpass`, you get:

» brew install sshpass
Error: No available formula with the name “sshpass”
We won’t add sshpass because it makes it too easy for novice SSH users to ruin SSH’s security.

Too easy for novice SSH users…” — Very holy attitude here.

Don’t worry, go and download the source:

Then, unzip the source with your double-click utility.

Graphically drag the unzipped directory to the Terminal.

» ./configure
» sudo make install

It’s installed!

» which sshpass

To use it, see: http://linux.die.net/man/1/sshpass

In summary:

sshpass -p “password” ssh user@host

But wait, there is more! If Keychain keeps nagging you about the passphrase, add this option to SSH:

-o “PubkeyAuthentication=no”
Like what you read? Give David Rosson a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.