简体   繁体   English

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

[英]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
  1. Download rpm file 下载 rpm文件
  2. # su - #su -
  3. # rpm -ivh [pass to your rpm file] #rpm -ivh [传递给你的rpm文件]

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.

相关问题 Amazon Linux AMI ec2实例权限被拒绝(公钥) - Amazon Linux AMI ec2 instance Permission denied (Public key) 在亚马逊 ec2 linux 微型实例上的 virtualenv 中安装 scipy 时遇到问题 - Trouble installing scipy in virtualenv on a amazon ec2 linux micro instance 如何在Amazon EC2 Linux AMI实例上安装Zend Optimizer? - How do I install Zend Optimizer on an Amazon EC2 Linux AMI instance? 指向Amazon Linux AMI测试页而非WP网站的AWS EC2实例 - AWS EC2 Instance Pointing to Amazon Linux AMI Test Page Rather than WP Site 在基于定制的Amazon Linux AMI启动ec2之后,更改了第二虚拟主机的DocumentRoot - Second Virtual Host's DocumentRoot is changed after launching ec2 based on customized Amazon Linux AMI 如何在Amazon Linux AMI EC2上安装“ autoconf-archive” - How to install “autoconf-archive” on Amazon Linux AMI EC2 Amazon Linux AMI EC2-librrd.so.2依赖性问题 - Amazon Linux AMI EC2 - librrd.so.2 dependency issue 在Amazon EC2 linux AMI上安装FFMPEG-Php - FFMPEG-Php installation on Amazon EC2 linux AMI Amazon Linux AMI ec2 GUI/远程桌面 - Amazon Linux AMI ec2 GUI / Remote Desktop EC2 Amazon AMI Linux 发行版上的 Packer 安装问题 - Packer installation Issues on EC2 Amazon AMI Linux distribution
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM