gitlab ssh連接需要輸密碼
背景:
gitlab ssh連接突然需要輸密碼
獲取詳情:
ssh連接加-v顯示詳情
ssh -v -T git@xx.xx.com
debug1: send_pubkey_test: no mutual signature algorithm
debug1: Offering public key: /Users/xx/.ssh/id_rsa_newigit RSA SHA256:/xxx explicit
debug1: send_pubkey_test: no mutual signature algorithm
debug1: Next authentication method: password
git@xx.xx.com's password:
原因:
以前某一天不經意把openssh給升級到9.4了。
客戶端和服務器之間沒有共同支持的公鑰簽名算法。
客戶端使用的是OpenSSH_9.4,而服務器使用的是OpenSSH_6.6.1。從OpenSSH_8.8開始,ssh-rsa算法被棄用,因為它使用了不安全的SHA-1哈希函數1。
客戶端和服務器都不支持更安全的rsa-sha2-256或rsa-sha2-512算法,所以公鑰驗證失敗了,只能使用密碼驗證。
解決方法:
~/.ssh/config
單個HOST配置下添加
PubkeyAcceptedKeyTypes=+ssh-rsa
HostKeyAlgorithms=+ssh-rsa
ps
還是gpt好用

浙公網安備 33010602011771號