1)首先:配置ssh服务器配置文件。
在root 用户下才能配置。
vi /etc/ssh/sshd_config
权限设为no:
#PermitRootLogin yes #UsePAM yes #PasswordAuthentication yes
如果前面有# 号,将#号去掉,之后将yes修改为no。
修改之后为:
PermitRootLogin no UsePAM no PasswordAuthentication no
权限设为yes:
RSAAuthentication yes PubkeyAuthentication yes
2)重启sshd服务
systemctl restart sshd.service systemctl status sshd.service #查看ssh服务的状态 #systemctl start sshd.service #开启ssh服务 #sytemctl enable sshd.service #ssh服务随开机启动,还有个disabled #systemctl stop sshd.ervice #停止
正常情况下应该是Active:active(running)
3)修改文件夹以及文件的权限。
#chmod 700 /home/Hadoop/.ssh #chmod 644 /home/Hadoop/.ssh/authorized_keys
4)在slave1上进行测试
ssh slave2
image
上面就是完整的解决这个问题的办法!
总结:出现这种警告,我觉得最终的原因是文件夹以及文件的读写权限的问题。
建议首先修改/home/Hadoop/.ssh以及/home/Hadoop/.ssh/authorized_keys的权限。
注意,还有可能是禁用了root登录出现这种情况。
当切换到普通用户—Hadoop之后就又能登录了。
image
即使在/etc/ssh/sshd_config 中配置了PermitRootLogin 为yes,还是不能用slave1的root用户直接无密码连接到slave2上。只要切换到会普通用户就可以了,不影响使用。毕竟root用户在Linux系统中如此特殊和重要。
最新评论: