1、服务器上~/.ssh权限一定要正确:
# paste these into an SSH session that server (probably from
# another user account or root)
# change this to YOUR username on the server.
UN=example
# paste these lines verbatim:
sudo chown $UN:$UN /home/$UN/{.,.ssh/,.ssh/authorized_keys}
sudo chmod u+rwX,go-rwX,-t /home/$UN/{.ssh/,.ssh/authorized_keys}
sudo chmod go-w /home/$UN/
2、客户机的私钥权限也要正确:
报错:It is required that your private key files are NOT accessible by others.
修改权限:
chmod 600 ~/.ssh/id_rsa