//同步内容
~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys:
//设置权限
chmod 600 ~/.ssh/authorized_keys
chmod 700 -R .ssh
//我遇到的原因: root 用户创建的 id_rsa.pub, xshell 用 其它用户名登录 会提示 所选用户密钥未在远程主机上注册的问题,换成root 用户名登录就可以了
Connecting to 127.0.0.1:2200...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.
Welcome to Ubuntu 22.04 LTS (GNU/Linux 4.4.0-19041-Microsoft x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
System information as of Fri May 20 10:12:40 CST 2022
System load: 0.5185546875 Processes: 16
Usage of /home: unknown Users logged in: 0
Memory usage: 70% IPv4 address for wifi0: 192.168.101.119
Swap usage: 0%
36 updates can be applied immediately.
22 of these updates are standard security updates.
To see these additional updates run: apt list --upgradable
Last login: Fri May 20 09:57:02 2022 from 127.0.0.1
root@ZJZL-20220519FY:~#