手动获取嵌入式系统上的ssh访问权限(可以直接进行硬盘访问)

我再次提出一个关于ssh问题的问题: 在嵌入式系统(没有显示器,没有键盘)上,我唯一的登录界面是ssh。 Telnet也被禁用。 (我目前正试图以很少的希望启用它......) 我目前唯一的互动是收到一个
ping
的答案并通过
smb://
浏览我的共享文件! ssh的答案总是:
$ ssh -vvvvl root 192.168.0.3
OpenSSH_5.5p1 Debian-4ubuntu4, OpenSSL 0.9.8o 01 Jun 2010
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to 192.168.0.3 [192.168.0.3] port 22.
debug1: Connection established.
debug1: identity file /home/simon/.ssh/id_rsa type -1
debug1: identity file /home/simon/.ssh/id_rsa-cert type -1
debug1: identity file /home/simon/.ssh/id_dsa type -1
debug1: identity file /home/simon/.ssh/id_dsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_4.3p2 Debian-8
debug1: match: OpenSSH_4.3p2 Debian-8 pat OpenSSH_4*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.5p1 Debian-4ubuntu4
debug2: fd 3 setting O_NONBLOCK
debug1: SSH2_MSG_KEXINIT sent
Read from socket failed: Connection reset by peer
但我通过将硬盘拉出设备并在连接到另一台机器时操纵文件来直接访问硬盘。 在我退出并被锁定之前,我的最后一步是
sudo rm /etc/ssh/*host*key*
,然后是
dpkg-reconfigure openssh-server
,因为找不到
dpkg-reconfigure
而失败了。所以我猜问题是,密钥被删除了。 我现在的问题是:如何在没有在目标系统上运行任何命令的情况下离岸创建密钥并将其提供给
sshd
或者如何让我在没有密钥的情况下登录? 如果有任何问题,感谢您的帮助..?!     
已邀请:
您可以在方便的Linux系统上生成一组新的主机密钥,如下所示:
ssh-keygen -t rsa -b 2048 -f ssh_host_rsa_key
ssh-keygen -t dsa -b 1024 -f ssh_host_dsa_key
ssh-keygen
要求你输入密码时,点击
Enter
而不输入任何内容。主机密钥必须具有空密码。 这将在当前目录中创建以下文件:
ssh_host_rsa_key
ssh_host_rsa_key.pub
ssh_host_dsa_key
ssh_host_dsa_key.pub
然后,您可以安装设备的硬盘驱动器并将这四个文件复制到
etc/ssh
。 请注意,当您尝试之后ssh到系统时,您的ssh客户端会抱怨密钥与预期不同,并且可能拒绝连接。如果您正在运行OpenSSH客户端,则可以再次使用
ssh-keygen
更正此问题:
ssh-keygen -R <your_server_hostname>
    
ssh -vvvvl root 192.168.0.3 应该: ssh -vvvvl root@192.168.0.3 我不知道这是否只是您在stackoverflow上发布时所做的拼写错误,或者您是否在命令行中输入了它。     

要回复问题请先登录注册