今天想在OpenWRT的shell下,使用SSH证书远程连接到另一台Linux设备,报告了一个String too long的错误。
原因是OpenWRT使用的SSH客户端是Dropbear,而不是OpenSSH,所以OpenSSH的秘钥不可以直接被使用,需要转换一下格式。
root@OpenWrt:/home# ssh -i key.pem user@ip
ssh: Exited: String too long
root@OpenWrt:/home# ssh -V
Dropbear v2020.81
root@OpenWrt:/home# opkg update && opkg install dropbearconvert && dropbearconvert
All arguments must be specified
Usage: dropbearconvert <inputtype> <outputtype> <inputfile> <outputfile>
CAUTION: This program is for convenience only, and is not secure if used on
untrusted input files, ie it could allow arbitrary code execution.
All parameters must be specified in order.
The input and output types are one of:
openssh
dropbear
Example:
dropbearconvert openssh dropbear /etc/ssh/ssh_host_rsa_key /etc/dropbear_rsa_host_key
#转换格式
root@OpenWrt:/home#dropbearconvert openssh dropbear key.pem key.dropbear
好了现在就可以正常连接了~