web-dev-qa-db-ja.com

sshdログファイルの検索

サーバーでSSHDに問題が発生しています。パスワードなし(pub/pvキー)認証を設定しようとしています。他のサーバーでは機能しましたが、このサーバーでは機能しませんでした。 SSHDエージェントは、「許可されたキー」に公開キーを追加しますが、それでもパスワードを要求します。 (/ etc/ssh/sshd_confで)完全にパスワード認証を無効にして何が起こるかを確認しようとしましたが、「不正な公開鍵」が表示されます。

Pubキーはクライアントによって送信されます(ssh -vvv):

 ----
 debug1: Next authentication method: publickey
 debug1: Offering RSA public key: /home/me/.ssh/id_rsa
 debug3: send_pubkey_test
 debug2: we sent a publickey packet, wait for reply
 debug1: Authentications that can continue: publickey,password
 debug1: Trying private key: /home/me/.ssh/id_dsa
 ----
 ## Next key (rsa was the good one)

「sshd_config」と「.ssh」のアクセス許可を確認しました。サーバー側で何が起こっているかを確認したいだけです。 「/ var/log/auth」と「/ var/log/secure」を確認しましたが、ここにファイルがありません。

構成では、ログを次のように構成しました。

 SyslogFacility AUTH
 LogLevel DEBUG

ディープネットワークスニッフィングを使用せずに状況をデバッグするにはどうすればよいですか? Sshd出力をログファイルまたはstdにリダイレクトすることは可能ですか?

ありがとうございました

5
Neozaru

サーバーで何が起こっているかを確認する方法は、次のオプションを使用してsshdデーモンを起動することです。

  /usr/sbin/sshd -dD 

2つのオプションは(manページから):

-Dこのオプションを指定すると、sshdはデタッチせず、デーモンになりません。これにより、sshdを簡単に監視できます。

-d      Debug mode.  The server sends verbose debug output to standard error, and does not put itself in the
         background.  The server also will not fork and will only process one connection.  This option is only
         intended for debugging for the server.  Multiple -d options increase the debugging level.  Maximum is
         3.

これは十分なはずです。過去には、それはあなたのディストリビューションに依存します。 /var/log/auth.logにメッセージが表示されますが、同じディレクトリでsshに関連するメッセージを検索できます。

    find /var/log -type f -exec grep -l ssh {} \;

これは、式sshを含むすべてのファイルの名前を出力します。次に、それらのコンテンツを確認する必要があります。

3
MariusMatutiae