[英]installing sshpass on amazon linux AMI based ec2 instance
I am planning to automate aws-rackspace server migration. 我计划自动化aws-rackspace服务器迁移。 I am following the official rackspace documentation( https://github.com/cloudnull/InstanceSync/blob/master/rsrsyncLive.sh ) which uses rsync to migrate.
我正在关注使用rsync进行迁移的官方机架文档( https://github.com/cloudnull/InstanceSync/blob/master/rsrsyncLive.sh )。 I have modified the code to use sshpass to dynamically provide login password while making an SSH connection to the remote server.
我修改了代码以使用sshpass在与远程服务器建立SSH连接时动态提供登录密码。
sshpass -p "YOUR_PASSWORD" ssh -o StrictHostKeyChecking=no username@IPAddress
But I am facing trouble installing sshpass package. 但是我在安装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)
I even tried 'yum update' and then 'yum -y install sshpass' but it didn't work. 我甚至试过'yum update'然后'yum -y install sshpass'但它没有用。
Thanks, 谢谢,
You need to manually download source code of sshpass ,after that 之后你需要手动下载sshpass的源代码
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 注意::如果找不到make,则可以运行以下命令来安装make
sudo yum groupinstall "Development Tools"
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 这是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
I found this answer on another stack overflow page , but it worked for me when yum install sshpass
was returning 我在另一个堆栈溢出页面上找到了这个答案,但是当
yum install sshpass
返回时它对我yum install sshpass
"No package sshpass available"
“没有包sshpass可用”
when trying to install on an AWS instance. 尝试在AWS实例上安装时。
Command: 命令:
yum --enablerepo=epel -y install sshpass
On Ansible Master (Amazon Linux) Before: 在Ansible Master(亚马逊Linux)之前:
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! Ping工作了!
linux1 | SUCCESS => {
"changed": false,
"ping": "pong"
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.