[英]installing sshpass on amazon linux AMI based ec2 instance
我计划自动化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'但它没有用。
谢谢,
之后你需要手动下载sshpass的源代码
Extract it and cd into the directory
./configure
sudo make install
注意::如果找不到make,则可以运行以下命令来安装make
sudo yum groupinstall "Development Tools"
我认为一些细节可能有助于快速完成这项工作。
这是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
我在另一个堆栈溢出页面上找到了这个答案,但是当yum install sshpass
返回时它对我yum install sshpass
“没有包sshpass可用”
尝试在AWS实例上安装时。
命令:
yum --enablerepo=epel -y install sshpass
在Ansible Master(亚马逊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
Ping工作了!
linux1 | SUCCESS => {
"changed": false,
"ping": "pong"
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.