配置ssh免密登陆

免密配置
执行命令 ssh-keygen ,一路回车,在当前用户 ~.ssh下会有三个文件(id_rsa,id_rsa.pub,known_hosts),
再添加一个authorized_keys 文件,将你想免密的机器全部如此配置,将所有机器的id_rsa.pub
内容拷贝进authorized_keys 文件,然后将authorized_keys 再拷贝进所有机器的用户 .ssh下,

就可以成功开启免密登陆了,如果此时还不行

1./etc/ssh/sshd_config 是否开启免密

[root@ljp ~]# vim /etc/ssh/sshd_config 
#RSAAuthentication yes
#PubkeyAuthentication yes
AuthorizedKeysFile      .ssh/authorized_keys

2、 CentOS的selinux是否开启

//暂时关闭
setenforce 0

//永久关闭
[root@charge ~]# vim /etc/selinux/config
..
SELINUX=disabled

猜你喜欢

转载自blog.csdn.net/xuxie13/article/details/84317126