Unix免密登录不成功的解决

配置免密登录:

master到node01-node03的免密登录

1、在master上用username依次执行:

ssh-keygen chmod 700 ~/.ssh

chmod 600 ~/.ssh/authorized_keys

cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys

这时,authorized_keys中应该有master机器名的字样

2、接下来将生成的authorized_keys复制到其他节点对应位置:

scp ~/.ssh/authorized_keys username@node01:~/.ssh/authorized_keys

scp ~/.ssh/authorized_keys username@node02:~/.ssh/authorized_keys

scp ~/.ssh/authorized_keys username@node03:~/.ssh/authorized_keys

至此,master对其他节点ssh无密码登陆配置成功,可以ssh下对应节点尝试是否成功。

发现免密登录不成功,检查安全登录日志(sudo cat /var/log/secure):

Jul 24 14:53:51 serv61 sshd[6620]: warning: /etc/hosts.allow, line 13: missing ":" separator
Jul 24 14:53:51 serv61 sshd[6620]: Authentication refused: bad ownership or modes for directory /home/zyhadoop
Jul 24 14:53:54 serv61 sshd[6620]: Accepted password for zyhadoop from 10.224.234.201 port 39770 ssh2
Jul 24 14:53:54 serv61 sshd[6620]: pam_unix(sshd:session): session opened for user zyhadoop by (uid=0)
Jul 24 14:54:10 serv61 sudo: zyhadoop : TTY=pts/1 ; PWD=/home/zyhadoop ; USER=root ; COMMAND=/bin/cat /var/log/secure
Jul 24 14:54:10 serv61 sudo: pam_tally2(sudo:setcred): unknown option: no_magic_root

观察到 /home/zyhadoop的用户权限有问题,修改目录权限:

 chmod 755 zyhadoop

 免密登录成功。

你可能感兴趣的:(Unix)