RockyLinux / AlmaLinux / RedHat 9.3 以降では、root アカウントでssh でのパスワードログインを行う場合、9.2以前とは異なり一部修正が必要です
修正するファイルは以下の3個
/etc/cloud/cloud.cfg
disable_root: 0 ssh_pwauth: 1
/etc/ssh/sshd_config
PermitRootLogin yes PasswordAuthentication yes
sshd_config 内で以下のファイルを読み込んでいる
Include /etc/ssh/ssh_config.d/*.conf
[root@rocky-test]# cat /etc/ssh/sshd_config.d/50-cloud-init.conf
PasswordAuthentication no
この 50-cloud-init.conf ファイルを「削除」 もしくは PasswordAuthentication yes に変更
rootのパスワード設定
[root@rocky-test]# passwd Changing password for user root. New password: ← パスワードの入力 Retype new password: ← パスワードの再入力 passwd: all authentication tokens updated successfully. [root@rocky-test]#
sshd の再起動
[root@rocky-test ~]# systemctl restart sshd [root@rocky-test ~]#
Firewall で22番ポートでのアクセスを許可