ansible不配ssh连接,用户密码登录
2018-02-23 00:00
267 查看
ansible 不配ssh免密链接,直接用ssh用户密码连接,要先装sshpass。
sshpass下载地址:http://sourceforge.net/projects/sshpass/
运行下列命令安装:
安装完成后输入sshpass出现如下提示即安装成功:
/etc/ansible/hosts文件中添加用户密码,认证ssh连接
错误汇总:
ssh第一次连接的时候一般会提示输入yes 进行确认为将key字符串加入到 ~/.ssh/known_hosts 文件中。而本机的~/.ssh/known_hosts文件中并有fingerprint key串
解决方法:在ansible.cfg文件中更改下面的参数:
#host_key_checking = False 将#号去掉即可
参考网址:
https://www.cnblogs.com/iois/p/6230800.html
https://www.cnblogs.com/ylqh/p/5902259.html
sshpass下载地址:http://sourceforge.net/projects/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.103 ansible_ssh_user=root ansible_ssh_port=22 ansible_ssh_pass=123456
错误汇总:
[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." }
ssh第一次连接的时候一般会提示输入yes 进行确认为将key字符串加入到 ~/.ssh/known_hosts 文件中。而本机的~/.ssh/known_hosts文件中并有fingerprint key串
解决方法:在ansible.cfg文件中更改下面的参数:
#host_key_checking = False 将#号去掉即可
参考网址:
https://www.cnblogs.com/iois/p/6230800.html
https://www.cnblogs.com/ylqh/p/5902259.html
相关文章推荐
- 如何使用PLSQL添加用户和密码,登录时可以免输入密码 PLSQL配置新数据库连接
- 防止远程密码拦截破译,ssh验证和普通用户登录
- Linux下制作不用密码可立即登录的SSH用户
- 普通用户实现ssh无密码登录
- SSH 无密码,用户自动登录
- linux下开启SSH,并且允许root用户远程登录,允许无密码登录
- 【Hadoop系列】linux下 root用户免密码登录远程主机 ssh
- CentOS 6.9 SSH配置用户免密码登录
- Linux下制作不用密码可立即登录的SSH用户
- ansible通过设置密码的私钥连接实现免密码登录
- linux 普通用户ssh 证书导入,证书登录不需要密码
- SQL Server2005常见错误及解决方案;'用户 'sa' 登录失败。该用户与可信 SQL Server 连接无关联;忘记sa密码;
- 【Struts2+Hibernate3+Spring3】利用SSH整合,完成打印用户表,用户登录、注册、修改密码系统
- 非root用户下实现SSH免密码登录
- 零基础Linux教程第四课“SSH密匙登录Linux,WinSCP教程,修改Linux用户密码”
- Oracle中管理用户(创建用户,用户加锁,用户解锁,修改用户密码,授权登录权限,撤销登录权限,授权连接权限,conn命令,创建角色,并为角色赋权限,将角色赋给指定用户)
- Hadoop架设过程中实现普通用户权限下SSH无密码登录
- ubuntu 16.04 修改默认root密码,设置root用户自动登录,ssh root登录
- linux下开启SSH,并且允许root用户远程登录,允许无密码登录
- RHEL7.2 SSH无密码登录非root用户