Centos 无密码登录
2016-04-01 17:15
447 查看
知道自动化运维就都知道 Ansible,知道Ansible那类工具就都知道无密码登录;
无密码? 还不就是ssh信任么?虽然一般自动化运维都自带一些生成工具,但是不可能仅仅为了二、三台弄的那么麻烦~
而其实sshd自带的生成工具很简单!就那么几步解决无密码登录。
192.168.1.1 ansible
192.168.1.2 node1
192.168.1.3 node2
1、 到ansible主机上的sshd_config开启下面的参数并reload sshd。
RSAAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
2、 尽量不用scp,使用原生的ssh-copy-id进行密码传输
①、使用ssh-keygen -d 生成DES加密公钥;
②、使用将域名写入hosts文件后使用ssh-copy-id进行登录与公钥传输;
node1:
node2:
以上!
无密码? 还不就是ssh信任么?虽然一般自动化运维都自带一些生成工具,但是不可能仅仅为了二、三台弄的那么麻烦~
而其实sshd自带的生成工具很简单!就那么几步解决无密码登录。
192.168.1.1 ansible
192.168.1.2 node1
192.168.1.3 node2
1、 到ansible主机上的sshd_config开启下面的参数并reload sshd。
RSAAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
2、 尽量不用scp,使用原生的ssh-copy-id进行密码传输
①、使用ssh-keygen -d 生成DES加密公钥;
②、使用将域名写入hosts文件后使用ssh-copy-id进行登录与公钥传输;
node1:
[root@localhost ~]# ssh-copy-id -i .ssh/id_dsa.pub root@node1 The authenticity of host 'node1 (192.168.1.2)' can't be established. RSA key fingerprint is 28:7f:ab:9a:76:08:0d:5b:55:5c:c5:c9:a0:04:b2:15. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'node1,192.168.1.2' (RSA) to the list of known hosts. root@node1's password: Now try logging into the machine, with "ssh 'root@node1'", and check in: .ssh/authorized_keys to make sure we haven't added extra keys that you weren't expecting. [root@localhost ~]# ssh node1 Last login: Sat Apr 2 00:48:09 2016 [root@node1 ~]# logout Connection to node1 closed. [root@localhost ~]# clear
node2:
[root@localhost ~]# ssh-copy-id -i .ssh/id_dsa.pub root@node2 The authenticity of host 'node2 (192.168.1.3)' can't be established. RSA key fingerprint is 28:7f:ab:9a:76:08:0d:5b:55:5c:c5:c9:a0:04:b2:15. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'node2,192.168.1.3' (RSA) to the list of known hosts. root@node2's password: Now try logging into the machine, with "ssh 'root@node2'", and check in: .ssh/authorized_keys to make sure we haven't added extra keys that you weren't expecting. [root@localhost ~]# ssh node2 Last login: Sat Apr 2 00:49:19 2016 [root@node2 ~]# logout Connection to node2 closed. [root@localhost ~]# clear
以上!
相关文章推荐
- CentOS6.6安装cobbler
- Linux内核分析6:分析Linux内核创建一个新进程的过程
- linux7的网卡高可用 team
- linux内核调优基本方法
- linux JMX
- Linux文件系统与文本编辑器
- Centos6修改sysctl.conf报错解决方法
- Linux共享对象之编译参数fPIC
- Centos6.5 --配置 vsftp 服务器
- linux下安装JDK
- 服务器linux系统盘满了怎么办
- Linux下重新更改root密码-获取root权限
- RC522在S5PV210处理器上的linux驱动调试(3)
- Centos 多个mysql数据库
- Ubuntu 14.10/15.04/ Linux Mint 17.1 中用PPA方式安装Sublime Text 3
- netstat
- 【转载】Linux安全事件应急响应排查方法总结
- linux找不到网卡配置文件解决办法
- linux虚拟文件系统
- linux java Cannot allocate memory