openssh8.6默认不支持公钥ssh
2021年12月02日 21:51
起因
最近升级了自己的linux后, 更新gogs代码时,发现用不了了
反复测试原因,发现是最新版本openssh8.6关闭了公钥登录
错误提示
尝试了各种办法,会发现始终提示ssh登录失败
username@ip: Permission denied (publickey).
查看ssh详细信息
输出ssh调试信息,查看失败的具体原因
ssh -Tv username@ip #发现了一条提示,这就是登录失败的原因 ... debug1: Authentications that can continue: publickey debug1: Next authentication method: publickey debug1: Offering public key: /home/xxx/.ssh/id_rsa RSA SHA256:0IxiHWniJDBbsM8x0zx+zliWrl7PINcALzFFqVgKX/M agent debug1: send_pubkey_test: no mutual signature algorithm ...
解决办法
sudo vim /etc/ssh/ssh_config
#增加一条PubKeyAcceptedKeyTypes
Host *
PubKeyAcceptedKeyTypes +ssh-rsa
# ForwardAgent no
# ForwardX11 no
# PasswordAuthentication yes
# HostbasedAuthentication no
# GSSAPIAuthentication no
# GSSAPIDelegateCredentials no
# GSSAPIKeyExchange no
# GSSAPITrustDNS no
# BatchMode no
问题原因
rsa有安全问题,新版本openssh,默认不支持rsa公钥登录,需要自己打开

