sshpass: command not found error

One solution I got for CentOS 7 :

  1. Download sshpass from here

And rpm will be downloaded.

  1. Transfer this rpm to your linux system (you can use filezilla etc.).
  2. Install the Rpm using: yum install <rpm file name>.

DONE


NO!!!! Don't install sshpass. It is the wrong tool for your job.

It was not written for your use case, and if you do use it, your script will be considerably less secure than it can be. I should know what I'm talking about. I wrote it.

Instead, run your server with debugging info and figure out why you failed to set up key based authentication. It is preferable to using sshpass in every possible way.


you will need to install sshpass on the client server you are running your code in which is a tool that is not installed by default on most Linux distro

if you are in Ubuntu use this command

apt-get install sshpass

on centOS/redhat use this install epel

wget https://archives.fedoraproject.org/pub/archive/epel/6/x86_64/epel-release-6-8.noarch.rpm

rpm -ivh epel-release-6-8.noarch.rpm

install sshpass

yum --enablerepo=epel -y install sshpass

Thanks