修复 ssh: Exited: String too long 在 OpenWRT 上
问题
当尝试在 OpenWRT 上使用私钥执行 SSH 时,例如
example_ssh_cmd.sh
ssh -i id_rsa user@host你遇到此错误:
error_output.txt
ssh: Exited: String too long解决方案
此错误发生是因为 OpenWRT 上的 ssh 可执行文件与你在普通计算机上期望的 SSH 不同:
dropbear_version.sh
root@OpenWRT:~# ssh
Dropbear client v2011.54DropBear SSH 变体期望 SSH 密钥为 DropBear 格式而不是 PEM 格式(由 ssh-keygen 生成)。要生成新密钥,像这样使用 dropbearkey:
generate_dropbear_key.sh
dropbearkey -f id_rsa -t rsa -b 2048要将现有密钥转换为 DropBear 格式,尝试使用 dropbearconvert
你可以像这样从 DropBear 密钥提取公钥:
extract_pubkey.sh
dropbearkey -y -f id_rsaIf this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow