在基于amazon linux AMI的ec2实例上安装sshpass

Pat*_*ttu 4 linux ssh yum amazon-web-services rackspace-cloud

我计划自动化aws-rackspace服务器迁移.我正在关注使用rsync进行迁移的官方机架文档(https://github.com/cloudnull/InstanceSync/blob/master/rsrsyncLive.sh).我修改了代码以使用sshpass在与远程服务器建立SSH连接时动态提供登录密码.

sshpass -p "YOUR_PASSWORD" ssh -o StrictHostKeyChecking=no username@IPAddress
Run Code Online (Sandbox Code Playgroud)

但是我在安装sshpass包时遇到了麻烦.

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) 
Run Code Online (Sandbox Code Playgroud)

我甚至试过'yum update'然后'yum -y install sshpass'但它没有用.

谢谢,

MoV*_*Vod 8

在 Amazon Linux 2 上我这样做

sudo amazon-linux-extras install epel -y
sudo yum-config-manager --enable epel
sudo yum install sshpass
Run Code Online (Sandbox Code Playgroud)


Rah*_*obi 7

您需要手动下载源代码sshpass,后

Extract it and cd into the directory
./configure
sudo make install
Run Code Online (Sandbox Code Playgroud)

注意::如果找不到make,则可以运行以下命令来安装make

sudo yum groupinstall "Development Tools"
Run Code Online (Sandbox Code Playgroud)