LoginSignup
2
1

More than 3 years have passed since last update.

ssh接続ユーザー制限設定

Posted at

手順

1. /etc/ssh/sshd_configを開く。

次のコマンドを実行する。
vi /etc/ssh/sshd_config

2. ssh接続許可ユーザーを設定する。

/etc/ssh/sshd_configに次の形式でssh接続許可ユーザーを記述する。
AllowUsers ユーザー名

例.
AllowUsers tanaka

※ AllowUsersの記述形式は複数あり。
・接続許可ユーザー設定
AllowUsers ユーザー名
・接続許可ユーザー設定(複数)
AllowUsers ユーザー名1 ユーザー名2
・特定のIPアドレスからのみ接続許可ユーザー設定
AllowUsers ユーザー名@接続元IPアドレス
・特定のIPアドレスからのみ接続許可ユーザー設定(全ユーザー)
AllowUsers *@接続元IPアドレス

3. sshdを再起動(または再読み込み)して設定を反映する。

次のコマンドを実行する。
service sshd restart (または、service sshd reload)

まとめ

/etc/ssh/sshd_configに接続許可ユーザーを記述して、sshdを再起動する。

2
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
2
1