环境:三台主机
ceph-ncnode01 192.168.94.61
ceph-ncnode02 192.168.94.77
ceph-ncnode03 192.168.95.60
目标:三台主机两两免密码互连
systemctl stop firewalld
setenforce 0
1、在三台主机上分别添加如下:
#vi /etc/hosts
192.168.94.61 ceph-ncnode01
192.168.94.77 ceph-ncnode02
192.168.95.60 ceph-ncnode03
vi /etc/ssh/sshd_config
PermitRootLogin yes 能让root远程
PasswordAuthentication yes 启用密码认证
2、配置免密码登录
在ceph-ncnode01、ceph-ncnode02、ceph-ncnode03机器上生成秘钥
[root@ceph-ncnode01 ~]# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
/root/.ssh/id_rsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
9f:07:12:21:89:17:aa:83:46:50:dd:f1:e4:f1:2f:95 root@jumpserver
The key's randomart image is:
+--[ RSA 2048]----+
|.... o+++ |
|. o.+= + . |
| . .. + . E |
|.. . . o |
|..o S o . |
|. . o + |
| o . |
| . |
| |
+-----------------+
2.1在ceph-ncnode01节点配置免密码登录
[root@ceph-ncnode01 ~]# cd .ssh/
[root@ceph-ncnode01 ~]# ls
authorized_keys id_rsa id_rsa.pub known_hosts
[root@ceph-ncnode01 ~]# cat id_rsa.pub >> authorized_keys
[root@ceph-ncnode01 ~]# chmod 600 authorized_keys
2.2复制ceph-ncnode01节点的/root/.ssh/文件夹下的所有文件到ceph-ncnode02、ceph-ncnode03节点;
[root@ceph-ncnode01 ~]# scp /root/.ssh/* root@ceph-ncnode02:/root/.ssh/
[root@ceph-ncnode01 ~]# scp /root/.ssh/* root@ceph-ncnode03:/root/.ssh/
2.3验证无密码登录
root@ceph-ncnode01:~# ssh ceph-ncnode02
Welcome to Ubuntu 16.04.1 LTS (GNU/Linux 4.4.0-47-generic x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
Get cloud support with Ubuntu Advantage Cloud Guest:
http://www.ubuntu.com/business/services/cloud
0 packages can be updated.
0 updates are security updates.
Last login: Tue Sep 19 02:45:53 2017 from 192.168.95.60
root@ceph-ncnode02:~#
root@ceph-ncnode01:~# ssh ceph-ncnode03
Welcome to Ubuntu 16.04.1 LTS (GNU/Linux 4.4.0-47-generic x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
Get cloud support with Ubuntu Advantage Cloud Guest:
http://www.ubuntu.com/business/services/cloud
0 packages can be updated.
0 updates are security updates.
Last login: Tue Sep 19 02:45:53 2017 from 192.168.95.60
root@ceph-ncnode03:~#