LoginSignup
1
1

More than 1 year has passed since last update.

さくらVPSのUbuntuで `ssh: connect to host xxxxx.vs.sakura.ne.jp port 22: Operation timed out` になったときの調べ方

Posted at

初めて触ってみた日に環境構築して、その次の日にSSHがタイムアウトする現象が起きたのでメモ。

早速ググって以下の記事を見て調べる前に試したものの再起動では治らず・・・

前日にパケットフィルターにHTTPとSSHの設定を行なっているため以下の記事も参考にならず・・・

そして改めて公式ドキュメントを確認することに。
Q&Aのiptables操作について、Ubuntuのバージョンが違うものの試したところ、そもそもそんなディレクトリはないと怒られてしまった笑汗

$ sudo ls /etc/iptables/iptables.rules
ls: cannot access '/etc/iptables/iptables.rules': No such file or directory

公式ドキュメントにファイアウォールがあれこれ書かれてあるため、そんなに操作していなかったufwを確認することに。
すると、さくらVPSのパケットフィルターの設定上ではHTTPとSSHの設定を行なっているもののufw上では追加されていないことが以下のように確認できた。
そのため、SSHを追加することでSSH接続が回復しましたー

$ sudo ufw status
Status: active

To                         Action      From
--                         ------      ----
Apache                     ALLOW       Anywhere
Apache (v6)                ALLOW       Anywhere (v6)

$ sudo ufw allow ssh

$ sudo ufw status
Status: active

To                         Action      From
--                         ------      ----
Apache                     ALLOW       Anywhere
22/tcp                     ALLOW       Anywhere
Apache (v6)                ALLOW       Anywhere (v6)
22/tcp (v6)                ALLOW       Anywhere (v6)
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1