root用户按照正常操作配置SSH无密码登录服务器,一切顺利,但是到非root用户的时候,就会出现各种各样的问题,这里,就统一解决一下这些出现的问题,这里以hadoop用户作为例子说明,依次执行如下命令
ssh-keygen -t rsa
cat /home/hadoop/.ssh/id_rsa.pub >> /home/hadoop/.ssh/authorized_keys
chmod 700 /home/hadoop/
chmod 700 /home/hadoop/.ssh
chmod 644 /home/hadoop/.ssh/authorized_keys
chmod 600 /home/hadoop/.ssh/id_rsa
ssh-copy-id -i /home/hadoop/.ssh/id_rsa.pub 到远程服务器 (此命令是关键)