我计划自动化aws-rackspace服务器迁移。我正在关注使用rsync进行迁移的官方机架文档(https://github.com/cloudnull/InstanceSync/blob/master/rsrsyncLive.sh)。我已修改代码以使用sshpass在与远程服务器建立SSH连接时动态提供登录密码。
sshpass -p "YOUR_PASSWORD" ssh -o StrictHostKeyChecking=no username@IPAddress
但是我在安装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)
我甚至试过'yum update'然后'yum -y install sshpass'但它没有用。
谢谢,
答案 0 :(得分:7)
您需要在此之后手动下载sshpass的源代码
Extract it and cd into the directory
./configure
sudo make install
注意::如果找不到make,则可以运行以下命令来安装make
sudo yum groupinstall "Development Tools"
答案 1 :(得分:3)
我认为一些细节可能有助于快速完成这项工作。
这是可以下载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
答案 2 :(得分:1)
答案 3 :(得分:0)
On Ansible Master(亚马逊Linux)之前:
<canvas id=c></canvas>
执行以下操作后:
linux1 | UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: Permission denied (publickey,password).\r\n",
"unreachable": true
}
Ping工作了!
sudo yum --enablerepo=epel -y install sshpass
答案 4 :(得分:0)
在 Amazon Linux 2 上我是这样做的
sudo amazon-linux-extras install epel -y
sudo yum-config-manager --enable epel
sudo yum install sshpass