ansible不配置ssh免密钥,使用密码登录
参考文档:
https://my.oschina.net/u/1433006/blog/1622893
1.安装sshpass
运行下列命令安装:
tar -zxvf sshpass-1.05.tar.gz
cd sshpass-1.05
./configure
make && make install
安装完成后输入sshpass出现如下提示即安装成功
#sshpass
Usage: sshpass [-f|-d|-p|-e] [-hV] command parameters-f filename Take password to use from file-d number Use number as file descriptor for getting password-p password Provide password as argument (security unwise)-e Password is passed as env-var "SSHPASS"With no parameters - password will be taken from stdin-h Show help (this screen)-V Print version information
At most one of -f, -d, -p or -e should be used
/etc/ansible/hosts文件中添加用户密码,认证ssh连接
[test]
127.0.0.1 ansible_ssh_user=root ansible_ssh_port=22 ansible_ssh_pass=123456
192.168.1.137 ansible_ssh_user=root ansible_ssh_port=22 ansible_ssh_pass=123456
2.错误汇总:
[root@localhost ~]# ansible test -m ping
127.0.0.1 | FAILED! => {"msg": "Using a SSH password instead of a key is not possible because Host Key checking is enabled and sshpass does not support this. Please add this host's fingerprint to your known_hosts file to manage this host."
}
192.168.1.103 | FAILED! => {"msg": "Using a SSH password instead of a key is not possible because Host Key checking is enabled and sshpass does not support this. Please add this host's fingerprint to your known_hosts file to manage this host."
}
3.原因和解决办法:
ssh第一次连接的时候一般会提示输入yes 进行确认为将key字符串加入到 ~/.ssh/known_hosts 文件中。而本机的~/.ssh/known_hosts文件中并有fingerprint key串
解决方法:在ansible.cfg文件中更改下面的参数:
#host_key_checking = False 将#号去掉即可
转载于:https://blog.51cto.com/wujianwei/2082880
ansible不配置ssh免密钥,使用密码登录相关推荐
- ansible 批量部署ssh免密钥
1 创建ssh秘钥 yum install epel-release -y yum install sshpass -y ssh-keygen -t rsa 2 批量复制秘钥并授权 ansible w ...
- jenkins配置ssh免密码登陆
说明 jenkins构建时需要连接远程服务器并且执行脚本,这时就需要配置ssh免密钥登录.jenkins构建时都是以jenkins用户进行操作,所以要以jeknins用户来配置免密钥登录.本教程以用户 ...
- gitlab用户添加ssh免密钥认证后clone还是要求输入密码
今天在centos 7公网服务器上安装gitlab在配置ssh免密钥时遇到一个奇怪的事,正确添加了本机的公钥到gitlab账户上,进行clone时死活都要你输入密码gitlab使用yum安装的,之前在 ...
- Xshell配置ssh免密码登录-密钥公钥(Public key)与私钥(Private Key)登录
ssh登录提供两种认证方式:口令(密码)认证方式和密钥认证方式.其中口令(密码)认证方式是我们最常用的一种,这里介绍密钥认证方式登录到linux/unix的方法. 使用密钥登录分为3步: 1.生成密钥 ...
- linux配置ssh免密码,Linux下配置SSH免密通信 - “ssh-keygen”的基本用法
一.什么是SSH 引用百度百科的说明: SSH 为 Secure Shell的缩写,由 IETF 的网络小组(Network Working Group)所制定:它是建立在应用层基础上的安全协议. S ...
- 生产环境实战spark (5)分布式集群 5台设备之间hosts文件配置 ssh免密码登录
生产环境实战spark (5)分布式集群 5台设备之间 ssh免密码登录 之前已经在master节点单台设备上配置ssh免密码的登录工作,现在要做的事情是在5台设备之间实现ssh免密码操作.我在整个大 ...
- linux 配置免密码登录,Linux - 配置SSH免密登录 - “ssh-keygen”的基本用法
1 什么是SSH 引用百度百科的说明: SSH 为 Secure Shell的缩写,由 IETF 的网络小组(Network Working Group)所制定:它是建立在应用层基础上的安全协议. S ...
- centos配置ssh免密码登录后仍要输入密码的解决方法
From: https://blog.csdn.net/zwbill/article/details/80448939 前言 在搭建Linux集群服务的时候,主服务器需要启动从服务器的服务,如果通过手 ...
- ssh 免密_Linux下配置SSH免密通信 “sshkeygen”的基本用法
利用 SSH 协议可以有效防止远程管理过程中的信息泄露问题.SSH最初是UNIX系统上的一个程序,后来又迅速扩展到其他操作平台. 1 什么是SSH 引用百度百科的说明:SSH 为 Secure She ...
最新文章
- v-if 和 v-else-if 和v-else的使用
- 《研磨设计模式》chap15 组合模式(1)简介
- Tensorflow源码解析3 -- TensorFlow核心对象 - Graph
- SAP CRM WebClient UI和Hybris的controller是如何被调用的
- python图片超链接_python自动获得网页上的所有超链接并全部截图
- hadoop join
- Kubernetes 1.20 版本开始将弃用 Docker,是时候拥抱 Containerd 和 Podman 了!
- Bootstrap禁用某个按钮组
- idea一直在 downloading plugins for ... 失败
- win7 oracle数据库删除用户名,win7操作系统、 oracle10g 数据库创建、卸载 用户名的创建 、删除...
- android ant build.xml实例
- 自动化报表,标准化流程---“JSL”(JMP编程语言),与重复操作说拜拜
- 忆我在北邮四年中的几位老师(全)
- Laravel 使用Dingo API
- 工作中少说这“五句话”(必读)
- c语言get()的作用,c语言get函数的用法有哪些
- 微信小程序wx.uploadFile 上传图片慢优化
- php单位有哪些,css中的角度单位有哪些?
- vue实现瀑布流效果
- Codeblocks 新建操作(单c文件新建和c工程创建)