我需要login到进入只读状态的系统。 我可以ping它,但我不能再ssh了。 有一些特殊的命令行标志/参数我可以通过SSH,让我login到已进入只读模式的系统?
忘了添加确切的连接错误:
OpenSSH_5.3p1,OpenSSL 1.0.1e-fips 2013年2月11日 debug1:读取configuration数据/ etc / ssh / ssh_config debug1:应用选项* debug2:ssh_connect:needpriv 0 debug1:连接到192.168.0.4 [192.168.0.4]端口22。 debug1:build立连接。 debug1:身份文件/home/username/.ssh/identitytypes-1 debug1:身份文件/home/username/.ssh/identity-certtypes-1 debug1:身份文件/home/username/.ssh/id_rsatypes-1 debug1:身份文件/home/username/.ssh/id_rsa-certtypes-1 debug1:身份文件/home/username/.ssh/id_dsatypes-1 debug1:身份文件/home/username/.ssh/id_dsa-certtypes-1 ssh_exchange_identification:由远程主机closures的连接
我应该补充一点,ping对于那个盒子来说是相当健壮的:
ping 192.168.0.4 PING 192.168.0.4(192.168.0.4)56(84)字节的数据。 来自192.168.0.4的64个字节:icmp_seq = 1 ttl = 64时间= 0.662ms 来自192.168.0.4的64个字节:icmp_seq = 2ttl = 64时间= 0.088ms 来自192.168.0.4的64个字节:icmp_seq = 3 ttl = 64时间= 0.089ms
你可以通过调用一个没有login的shell会话来login。 例如,您可以在成功validation身份之后将命令传递给ssh :
ssh user@host bash --noprofile --norc
当然,这个使用bash作为shell。 不同的shell将需要适当的参数,以便不触发wtmp / utmp更新,也不会尝试做失败的事情并提早注销( 即,在shell正常打开login之前完成其常规任务会话)。
一个警告的提示:shell会相当( 非常 )有限,通常没有提示和其他幻想。 但是,进入机器并检查有什么问题就足够了。
编辑添加:根据主机的情况,可能需要指定完整path,例如/bin/bash作为成功validation时执行的命令。
简短的回答是,由于您所描述的系统问题,您的SSH服务器可能不起作用。 我不认为客户可以做任何不同的事情。
我将分解您的debugging跟踪:
debug1: Connecting to 192.168.0.4 [192.168.0.4] port 22. debug1: Connection established.
客户端连接到该地址和端口。 这意味着服务器上的sshd进程仍在运行。
debug1: identity file /home/username/.ssh/identity type -1 debug1: identity file /home/username/.ssh/identity-cert type -1 debug1: identity file /home/username/.ssh/id_rsa type -1 debug1: identity file /home/username/.ssh/id_rsa-cert type -1 debug1: identity file /home/username/.ssh/id_dsa type -1 debug1: identity file /home/username/.ssh/id_dsa-cert type -1
你本地的SSH客户端查找这些密钥文件,但没有find它们。 这些都是它通常会查找的默认密钥文件名称。 如果您希望其中一个文件存在,这只是一个问题。 他们在这里也没什么实际意义,因为客户从来没有机会authentication。
ssh_exchange_identification: Connection closed by remote host
远程服务器closures了TCP连接。 这个特定的消息意味着服务器在连接上做了一个“正常的”closures。 如果服务器崩溃,您将看到另一条消息,指出“通过对等方重置连接”。
通常情况下,SSH服务器要做的第一件事就是发送它的软件版本string。 如果这发生在这里,你可以在debugging轨迹中看到:
... debug1: identity file /home/foo/.ssh/id_ecdsa-cert type -1 debug1: Remote protocol version 2.0, remote software version OpenSSH_5.9p1 Debian-5ubuntu1.1 debug1: match: OpenSSH_5.9p1 Debian-5ubuntu1.1 pat OpenSSH*
在closures连接之前,服务器甚至没有这么做。
如果服务器是健康的,对于你所看到的通常的解释是服务器由于TCP包装而拒绝客户端。 但在你的情况下,有关系统状态可能会阻止sshd正常工作。 例如,在接受连接之后,服务器立即调用[fork()][2]来创build一个subprocess。 subprocess处理连接,而父进程继续监听进一步的连接。 如果分支失败,则服务器将closures连接而不向客户端发送任何东西。