我有一个使用AWS生成的密钥对进行身份验证的EC2实例。
使用Putty,我可以通过在PPK文件中提供私钥来连接到实例。
当我尝试使用SSH2 (通过NodeJs包装器之一,例如通过'ssh2-sftp-client‘模块)时,它失败时会出错:
getConnection: All configured authentication methods failed
实例上的auth.log报告,
sshd[1841]: userauth_pubkey: key type ssh-rsa not in PubkeyAcceptedAlgorithms [preauth]
我知道OpenSSH反对ssh-rsa,但我仍然不确定这里有什么问题:
?
SSH (服务器)版本是OpenSSH_8.9p1 Ubuntu-3, OpenSSL 3.0.2 15 Mar 2022
-编辑,因为我还不能发表评论--
@Tanjin Alam的答案是正确的,在AWS中,这可以通过在启动模板中的User Data字段中添加以下文本来自动完成:
#!/bin/bash
sed -i '$aPubkeyAcceptedKeyTypes=+ssh-rsa' /etc/ssh/sshd_config
service sshd restart发布于 2022-12-01 09:58:18
转到
/etc/ssh #goto this directory
sudo nano sshd_config #edit the file
PubkeyAcceptedKeyTypes=+ssh-rsa #add this line and save and quit
sudo systemctl restart sshd #restart sshd再试一次它会起作用的
参考资料:点击这里
https://serverfault.com/questions/1106758
复制相似问题