vi /etc/ssh/sshd_config
查找RSAAuthentication、StrictModes、PubkeyAuthentication、AuthorizedKeysFile把所在行修改为:
RSAAuthentication yes StrictModes no PubkeyAuthentication yes AuthorizedKeysFile .ssh/authorized_keys
重启SSH服务
systemctl restart sshd.service
然后用xshell或者linux自己的keygen生成私钥和公钥,把公钥拷贝到/root/.ssh/authorized_keys即可