Ansible: To use the ‘ssh’ connection type with passwords, you must install the sshpass program

“To use the ‘ssh’ connection type with passwords, you must install the sshpass program” to resolve this error message, you have to install sshpass package in your ansible control machine.

What is sshpass?
The sshpass utility is designed to run SSH using the keyboard-interactive password authentication mode, but in a non-interactive way. SSH uses direct TTY access to ensure that the password is indeed issued by an interactive keyboard user. sshpass runs SSH in a dedicated TTY, fooling SSH into thinking it is getting the password from an interactive user.

In OS X:
If you are trying to install through brew then you might face an error.

brew install https://raw.githubusercontent.com/kadwanev/bigboybrew/master/Library/Formula/sshpass.rb

Error message:

Traceback (most recent call last):
`brew extract` or `brew create` and `brew tap-new` to create a formula file in a tap on GitHub instead.: Invalid usage: Non-checksummed download of sshpass formula file from an arbitrary URL is unsupported!  (UsageError)
`brew extract` or `brew create` and `brew tap-new` to create a formula file in a tap on GitHub instead.: Invalid usage: Non-checksummed download of sshpass formula file from an arbitrary URL is unsupported!  (UsageError)

Therefore, I prefered installing sshpass through source code.

wget https://sourceforge.net/projects/sshpass/files/latest/download/sshpass/1.08/sshpass-1.08.tar.gz
tar xvf sshpass-1.08.tar.gz
cd sshpass-1.08
./configure
make
make install

In CentOS 7:

yum install sshpass

In Ubuntu:

apt install sshpass

Comments