sshd_configにユーザーオーバーライドを追加するとssh_exchange_identificationエラーが発生する

sshd_configにユーザーオーバーライドを追加するとssh_exchange_identificationエラーが発生する

特定のユーザーに対してSSH TCP転送を許可したいので、このセクションをsshd_configに追加します。

Match User rainmannoodles
    AllowTcpForwarding yes
    TCPKeepAlive yes

変更後に接続すると、次のメッセージが表示されます。

ssh_exchange_identification: Connection closed by remote host

「ユーザー一致」ブロックをコメントアウトすると、すべてがうまく機能します。このブロックはファイルの最後のブロックです。

私はこのような行動の理由を考えることはできません。ここで何が起こっているのでしょうか?全体-vvvの出力は次のとおりです。

OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to localhost [::1] port 22.
debug1: Connection established.
debug1: identity file /Users/rainmannoodles/.ssh/id_rsa type -1
debug1: identity file /Users/rainmannoodles/.ssh/id_rsa-cert type -1
debug1: identity file /Users/rainmannoodles/.ssh/id_dsa type -1
debug1: identity file /Users/rainmannoodles/.ssh/id_dsa-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.2
ssh_exchange_identification: Connection closed by remote host

ベストアンサー1

サーバーのログを調べて、何が間違っているかを確認してください。

sshdは、構成ファイルの形式が正しくないと文句を言うと予想されます。このオプションはTCPKeepAliveブロックでは使用できません。おそらくsshdは、認証が完了した後にこのオプション値の変更をサポートしていないためです(このオプションは、条件をテストするMatch前に接続の開始から使用されます)。Match

おすすめ記事