LoginSignup
1
1

More than 1 year has passed since last update.

ConoHa VPS の AlmaLinux9 でルートログイン禁止にしようとしてはまった話

Posted at

結論

/etc/ssh/sshd_config.d/01-permitrootlogin.confPermitRootLoginno にして、sshd サービス再起動する。

解説

これまで root での SSH ログインを禁止するために編集するファイルは /etc/ssh/sshd_config だった。
01_sshd_config.png

しかしRHEL9からは、 ssh_config.d というディレクトリが作られ、そこの中に PermitRootLogin を設定するだけのためのファイルが配置されるようになった。
02_ssh_config.d.png

そのため、いくら /etc/ssh/sshd_configPermitRootLogin の値を変更しようとも、その後から読み込まれる 01-permitrootlogin.conf で上書きされてしまっていた。
03_permitrootlogin.conf.png

そもそも

そもそもの話、RHEL9 からは、デフォルトでルートのパスワードログインは禁止されている。
だが ConoHa VPS だとサーバ作成時に、root パスワードが必須になっている。
そして 01-permitrootlogin.confPermitRootLoginyes と設定されている。
コントロールパネルのコンソールから操作するためなのだろう。
(そろそろ鍵必須でいいんじゃないか?)

1
1
1

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