Install sshpass on amazon linux eci instance based on ami

I plan to automate the aws-rackspace server migration. I follow the official rack documentation ( https://github.com/cloudnull/InstanceSync/blob/master/rsrsyncLive.sh ) which uses rsync for migration. I changed the code to use sshpass to dynamically provide a login password when connecting SSH to a remote server.

sshpass -p "YOUR_PASSWORD" ssh -o StrictHostKeyChecking=no username@IPAddress

But I ran into the problem of installing the sshpass package.

Debian based Distros - Installed Successfully
CentOS - Installed Successfully
Redhat - Package not found (yum list available | grep sshpass) 
Amazon Linux -  Package not found (yum list available | grep sshpass) 

I even tried "yum update" and then "yum -y install sshpass", but that didn't work.

Thank,

+3
source share
5 answers

sshpass,

Extract it and cd into the directory
./configure
sudo make install

. make, make

sudo yum groupinstall "Development Tools"
+7

, .

sshpass ( ): http://sourceforge.net/projects/sshpass/files/sshpass/1.05/ URL

$ wget http://sourceforge.net/projects/sshpass/files/sshpass/1.05/sshpass-1.05.tar.gz/download # on your amazon instance, to download using command line / terminal; this will get you a file named "download"

$ mv download sshpass-1.05.tar.gz # note this is the name as in the URL above

$ gunzip sshpass-1.05.tar.gz
$ tar xvf sshpass-1.05.tar

$ cd sshpass-1.05

$ sudo yum groupinstall "Development Tools" # in case configure & make (next 2 commands) does not work, else dont run this command

$ sudo ./configure

$ sudo make install

$ sudo -s
# which sshpass #sudo -s and check if sshpass is in the path; on amazon RHEL, for me the root did not have /usr/local/bin in its path; so you may want to set the path appropriately (echo $PATH), or copy sshpass to one of the $PATH directories
+3
  • rpm
  • # su -
  • # rpm -ivh [ rpm]
+1

, , yum install sshpass

" sshpass

AWS.

:

yum --enablerepo=epel -y install sshpass
+1

Ansible Master (Amazon Linux) :

linux1 | UNREACHABLE! => {
    "changed": false,
    "msg": "Failed to connect to the host via ssh: Permission denied (publickey,password).\r\n",
    "unreachable": true
}

:

sudo yum --enablerepo=epel -y install sshpass

!

linux1 | SUCCESS => {
    "changed": false,
    "ping": "pong"
}
0
source

All Articles