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

これは最小値です。既知のポートで失敗したパスワードを無制限に試すことができます。直接ルートログインが無効になっています(ログインしている場合でも、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を安全にしてください。協会

おすすめ記事