在 /root/.ssh 目录下,找到 authorized_keys 文件,它是空的,打开它,把从xshell复制的公钥内容放入里面
修改 /etc/ssh/sshd_config 文件

如果要禁用密码,在这个文件里面找到PasswordAuthentication yes 改为no
PasswordAuthentication no
重启服务
bash
systemctl daemon-reload
service sshd restart