installing sshpass on amazon linux AMI based ec2 instance
Asked Answered
C

6

6

I am planning to automate aws-rackspace server migration. I am following the official rackspace documentation(https://github.com/cloudnull/InstanceSync/blob/master/rsrsyncLive.sh) which uses rsync to migrate. I have modified the code to use sshpass to dynamically provide login password while making an SSH connection to the remote server.

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

But I am facing trouble installing 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 it didn't work.

Thanks,

Cask answered 5/2, 2014 at 5:2 Comment(0)
S
7

You need to manually download source code of sshpass,after that

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

Note :: If you do not find make then you can run following command for installing make

sudo yum groupinstall "Development Tools"
Surpassing answered 5/2, 2014 at 5:15 Comment(0)
C
8

On Amazon Linux 2 I do it like this

sudo amazon-linux-extras install epel -y
sudo yum-config-manager --enable epel
sudo yum install sshpass
Chromoprotein answered 25/6, 2021 at 2:6 Comment(0)
S
7

You need to manually download source code of sshpass,after that

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

Note :: If you do not find make then you can run following command for installing make

sudo yum groupinstall "Development Tools"
Surpassing answered 5/2, 2014 at 5:15 Comment(0)
P
4

I found this answer on another stack overflow page, but it worked for me when yum install sshpass was returning

"No package sshpass available"

when trying to install on an AWS instance.

Command:

yum --enablerepo=epel -y install sshpass
Prostration answered 24/2, 2018 at 0:21 Comment(0)
B
3

I thought a little bit of details may help to get this done quickly.

This is where sshpass can be downloaded from (search for any recent updates): http://sourceforge.net/projects/sshpass/files/sshpass/1.05/ And from the page get the URL for the download as below

$ 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
Bennie answered 12/9, 2014 at 1:14 Comment(1)
Helpful addition to the accepted answer. However, I would point out that ./configure does not need sudo. You probably should also run first make without sudo to compile and when that is done, run sudo make install.Maurreen
B
1
  1. Download rpm file
  2. # su -
  3. # rpm -ivh [pass to your rpm file]
Bainter answered 19/12, 2014 at 12:5 Comment(0)
L
0

On Ansible Master (Amazon Linux) Before:

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

After exection the following:

sudo yum --enablerepo=epel -y install sshpass

Ping worked!

linux1 | SUCCESS => {
    "changed": false,
    "ping": "pong"
}
Lollard answered 16/3, 2018 at 0:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.