私のサーバーにファイアウォールを持つApache Webサーバーをインストールしましたが、サーバーにSSH経由で接続できなくなりました。 debug1: key_load_public: そのファイルまたはディレクトリはありません。

私のサーバーにファイアウォールを持つApache Webサーバーをインストールしましたが、サーバーにSSH経由で接続できなくなりました。 debug1: key_load_public: そのファイルまたはディレクトリはありません。

サーバースペースを解放し、ファイアウォールを備えたApache Webサーバーをインストールしました。このチュートリアルただし、サーバーにSSH経由で接続しようとすると、このエラーが発生します。

OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n  7 Dec 2017
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to xx.xxx.xxx.xx [xx.xxx.xxx.xx] port 80.
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file /home/user/.ssh/id_rsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/user/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/user/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/user/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/user/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/user/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/user/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/user/.ssh/id_ed25519-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.6p1 Ubuntu-4ubuntu0.3
debug1: ssh_exchange_identification: HTTP/1.1 400 Bad Request


debug1: ssh_exchange_identification: Date: Tue, 02 Jul 2019 19:27:18 GMT


debug1: ssh_exchange_identification: Server: Apache/2.4.18 (Ubuntu)


debug1: ssh_exchange_identification: Content-Length: 313


debug1: ssh_exchange_identification: Connection: close


debug1: ssh_exchange_identification: Content-Type: text/html; charset=iso-8859-1


debug1: ssh_exchange_identification:


debug1: ssh_exchange_identification: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">

debug1: ssh_exchange_identification: <html><head>

debug1: ssh_exchange_identification: <title>400 Bad Request</title>

debug1: ssh_exchange_identification: </head><body>

debug1: ssh_exchange_identification: <h1>Bad Request</h1>

debug1: ssh_exchange_identification: <p>Your browser sent a request that this server could not understand.<br />

debug1: ssh_exchange_identification: </p>

debug1: ssh_exchange_identification: <hr>

debug1: ssh_exchange_identification: <address>Apache/2.4.18 (Ubuntu) Server at sample.com Port 80</address>

debug1: ssh_exchange_identification: </body></html>

ssh_exchange_identification: Connection closed by remote host

私はssh_configファイルとsshd_configファイルを見るためにvim scpを使ってみましたが、得たのは空のファイルだけでした。今はサーバーにアクセスできません。 key_load_publicファイルが何であるか、どのような形でなければならないのかわかりません。サーバーにはアクセスキーがなく、ユーザー名とパスワードのみがあります。

ベストアンサー1

コメントによると、サーバーでポート22を開く必要があるようです。 @GracefulRestartが述べたように、ポート22はSSHのデフォルトポートです。サーバーがポート80を使用してSSHセッションを開始しようとすると、実際にはSSHサーバーではなくApacheサーバーに接続されます。 Webサーバーは実際に404エラーページのHTMLで応答するので、私たちはあなたがWebサーバーと通信していることを知っています。

ポート22を開くには、参照したチュートリアルのステップ2に従ってください。アプリケーションをApacheではなくOpenSSHに変更します。次に、SSHセッションを再開して(ポート22で)確認します。

注:一定期間公衆インターネット上でSSHサーバーを使用する場合は、標準以外のSSHポートの使用を検討してください。ポート22を使用する場合〜するログイン試行を表示します。また、SSH経由のルートログインを無効にし、パスワードが規制に準拠していることを確認することも検討してください。

おすすめ記事