背景
升级ubuntu20后22后,远程连接工具无法通过public key方式登录主机。
分析&解决
查看sshd服务有报错journatl -xeu sshd
1月 10 19:10:01 k8s-master03 sshd[21093]: userauth_pubkey: key type ssh-rsa not in PubkeyAcceptedAlgorithms [preauth]
1月 10 19:10:03 k8s-master03 sshd[21093]: userauth_pubkey: key type ssh-rsa not in PubkeyAcceptedAlgorithms [preauth]
1月 10 19:10:04 k8s-master03 sshd[21093]: error: Received disconnect from xxxxx port 57752:0: [preauth]
1月 10 19:10:04 k8s-master03 sshd[21093]: Disconnected from authenticating user root xxxx port 57752 [preauth]
更改sshd配置文件
grep Algorithms /etc/ssh/sshd_config
HostKeyAlgorithms +ssh-rsa
PubkeyAcceptedAlgorithms +ssh-rsa
systemctl restart sshd
重新连接即可
1月 14 10:00:52 k8s-master03 sshd[3042859]: Accepted publickey for root from x port 65304 ssh2: RSA SHA256:x
1月 14 10:00:52 k8s-master03 sshd[3042859]: pam_unix(sshd:session): session opened for user root(uid=0) by (uid=0)