以前在做linux免密登录时只要执行:cat id_rsa.pub>> authorized_keys,就可以了
后来升级到rhel7之后不行,发现有两个需要改动:
1、修改ssh的配置文件/etc/ssh/sshd_config ,去掉两个参数的注释
PubkeyAuthentication yes(去掉注释#)
AuthorizedKeysFile .ssh/authorized_keys (rhel7.5默认是没有注释的,检查一下即可)
RSAAuthentication yes(rhel7.5中没有这个参数,无需理会)
2、修改 .ssh目录权限,去掉其他用户的读写权限
chmod 700 .ssh
chomd 600 .ssh/authorized_keys