ping 有效,ssh 超時

ping 有效,ssh 超時

我的筆記型電腦 (10.197.1.xx) 和桌上型電腦 (10.141.200.xxx) 上運行著 ubuntu 16.04 (mate)。從其中任何一個我都可以 ping 另一個。但是 ssh 去暫停(它不會拒絕連接,或給出任何警告或錯誤訊息)。

OpenSSH_7.2p2 Ubuntu-4ubuntu2.1, OpenSSL 1.0.2g  1 Mar 2016
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to 10.197.1.xxx [10.197.1.xxx] port 22.
debug1: connect to address 10.197.1.xxx port 22: Connection timed out
ssh: connect to host 10.197.1.xxx port 22: Connection timed out

有問題的 PC 和筆記型電腦都具有openssh 伺服器安裝。

$ sudo service sshd status

● ssh.service - OpenBSD Secure Shell server
   Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enab
   Active: active (running) since Mon 2017-04-10 09:59:50 IST; 4h 49min ago
  Process: 3682 ExecReload=/bin/kill -HUP $MAINPID (code=exited, status=0/SUCCES
 Main PID: 1096 (sshd)
   CGroup: /system.slice/ssh.service
           └─1096 /usr/sbin/sshd -D

Apr 10 10:37:18 H110M-DS2 systemd[1]: Reloading OpenBSD Secure Shell serve
Apr 10 10:37:18 H110M-DS2 sshd[1096]: Received SIGHUP; restarting.
Apr 10 10:37:18 H110M-DS2 systemd[1]: Reloaded OpenBSD Secure Shell server
Apr 10 10:37:18 H110M-DS2 sshd[1096]: Server listening on 0.0.0.0 port 22.
Apr 10 10:37:18 H110M-DS2 sshd[1096]: Server listening on :: port 22.
Apr 10 10:37:18 H110M-DS2 systemd[1]: Reloading OpenBSD Secure Shell serve
Apr 10 10:37:18 H110M-DS2 sshd[1096]: Received SIGHUP; restarting.
Apr 10 10:37:18 H110M-DS2 systemd[1]: Reloaded OpenBSD Secure Shell server
Apr 10 10:37:18 H110M-DS2 sshd[1096]: Server listening on 0.0.0.0 port 22.
Apr 10 10:37:18 H110M-DS2 sshd[1096]: Server listening on :: port 22.

防火牆狀態為不活躍的

sudo ufw status
Status: inactive

可能出什麼問題了?我如何讓 ssh 工作。

更新

traceroute程式產生以下輸出

traceroute to 10.197.1.xxx (10.197.1.xxx), 30 hops max, 60 byte packets
 1  router.xxx.xxxx.xx.in (10.xxx.xxx.1)  1.069 ms  1.388 ms  1.691 ms
 2  10.xxx.xxx.1 (10.xxx.xxx.1)  0.820 ms  0.814 ms  0.974 ms
 3  172.xx.x.1 (172.xx.x.1)  0.371 ms  0.384 ms  0.375 ms
 4  * * *
 5  * * *
 6  * * *
 7  * * *
 8  * * *
 9  * * *
10  * * *
11  * * *
12  * * *
13  * * *
14  * * *
15  * * *
16  * * *
17  * * *
18  * * *
19  * * *
20  * * *
21  * * *
22  * * *
23  * * *
24  * * *
25  * * *
26  * * *
27  * * *
28  * * *
29  * * *
30  * * *

答案1

sudo apt-get update
sudo apt-get install ssh
sudo ufw allow 22

這是最低限度。它允許在已知連接埠上無限制地嘗試失敗的密碼。直接 root 登入已停用(登入後您仍然可以 su 和 sudo)。如果您的使用者名稱和密碼可被猜出並且網路可以看到伺服器,那麼最終就會有人闖入。

預設情況下,root 使用者不允許在 ubuntu 中從外部進行 ssh。你可以改為

sudo sed -ir 's/^(PermitRootLogin) .+/\1 yes/' /etc/ssh/sshd_config
sudo /etc/init.d/ssh restart

如果您仍然遇到問題,請嘗試一下,telnet machineip 22它會顯示您可以從其他電腦存取 22 連接埠。嘗試按照此使 ssh 安全關聯

相關內容