SSH (SSHd) で特定のユーザにだけ特定の設定を付与する方法

結論

/etc/ssh/sshd_config の末尾に、Match User ディレクトリを用いて例えば以下のように記述します。すると、hogehogeuser は、sshd_config での全体の設定がどうであれ、パスワードでのログインが許可されます。

Match User hogehogeuser
  PasswordAuthentication yes

注意点

  • /etc/ssh/sshd_config というファイルの場所(ファイル名)は Ubuntu でのものですので、各環境に応じて読み替えて下さい
  • 必ず、 /etc/ssh/sshd_config末尾に追加して下さい
    • 最重要です
  • デフォルトの /etc/ssh/sshd_config の末尾に例文が載っていることがあります
# Example of overriding settings on a per-user basis
#Match User anoncvs
#  X11Forwarding no
#  AllowTcpForwarding no
#  PermitTTY no
#  ForceCommand cvs server
Powered by はてなブログ