嗨,我的 ssh 出现问题,它神奇地停止工作,我不知道为什么。它给出的信息是:
ssh: connect to host <host> port 22: Connection refused
我写的时候没有看到任何错误消息,dmesg
但我正在关注telnet localhost 22
Trying 127.0.0.1...
telnet: Unable to connect to remote host: Connection refused
我尝试了在一些类似案例[1]和[2]中看到的解决方案,但仍然没有解决我的问题,条目和输出如下:
>> sudo iptables -A INPUT -p tcp --dport ssh -j ACCEPT
>> sudo iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT tcp -- anywhere anywhere tcp dpt:ssh
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
请注意,这已经接受了,即使在输入命令之前我也没有任何问题sudo iptables -A INPUT -p tcp --dport ssh -j ACCEPT
。我也尝试重新启动 ssh 但它没有改变任何东西
>>netstat -a | egrep 'Proto|LISTEN'
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 localhost:20128 *:* LISTEN
tcp 0 0 localhost:17600 *:* LISTEN
tcp 0 0 localhost:20129 *:* LISTEN
tcp 0 0 localhost:17603 *:* LISTEN
tcp 0 0 localhost:21128 *:* LISTEN
tcp 0 0 deathstar:domain *:* LISTEN
tcp 0 0 localhost:ipp *:* LISTEN
tcp 0 0 *:db-lsp *:* LISTEN
tcp6 0 0 ip6-localhost:ipp [::]:* LISTEN
tcp6 0 0 [::]:db-lsp [::]:* LISTEN
我不知道还能尝试什么,所以希望这足以解决问题。
在@Ashu 的评论之后添加了休息
sudo lsof -i | grep ssh
没啥事儿
>>netstat -l --numeric-ports | grep 22
unix 2 [ ACC ] STREAM LISTENING 1618183 @jack-com.canonical.Unity.Master.Scope.files.T1731348652205882
>>sudo iptables --list
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT tcp -- anywhere anywhere tcp dpt:ssh
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
在@TheSchwa 的评论之后编辑
>>ps aux | grep sshd
jack 3711 0.0 0.0 15944 2220 pts/26 S+ 14:08 0:00 grep --color=auto sshd