【Linux】Centos配置ssh无密码登录

【测试环境】

   刚好重新做mgr就搞下吧,主要论文好长~想多做几遍再看~

master1 

192.168.13.111

master2  

192.168.13.112
 master3    192.168.13.1113

 

 【步骤】

    1.生成密匙(三台均需要)

 

[root@master1 ~]# ssh-keygen -t rsa    #之后一路回车

 

[root@master2 ~]# ssh-keygen -t rsa

 

 

 

[root@master3 ~]# ssh-keygen -t rsa

 

 

 

创建公共秘钥文件authorized_keys,就是这个名字不要改成其他的,并将所有id_rsa.pub内容追加进去(三台均做)

  ps:因为不想做ssh-copy-id这一步,所以直接创建

master1

[root@master1 ~]# cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys 
[root@master1 ~]# cat /root/.ssh/authorized_keys 
[root@master1 ~]# scp -r /root/.ssh/authorized_keys   root@192.168.13.112:/root/.ssh/

 

master2

[root@master2 ~]# cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys 
[root@master2 ~]# cat /root/.ssh/authorized_keys 
[root@master2 ~]# scp -r /root/.ssh/authorized_keys root@192.168.13.113:/root/.ssh/

 

master3

[root@master3 ~]# cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys 
[root@master3 ~]# cat /root/.ssh/authorized_keys 
[root@master3 ~]# scp -r /root/.ssh/authorized_keys root@192.168.13.111:/root/.ssh/
[root@master3 ~]# scp -r /root/.ssh/authorized_keys root@192.168.13.112:/root/.ssh/

 

效果

  

 

学无止境,谦卑而行.
posted @ 2018-09-29 11:45  。思索  阅读(472)  评论(0编辑  收藏  举报