📘

【EC2】RHEL9.4にてパスワード認証無しでSSH接続する

に公開

はじめに

RHEL9.4のEC2にパスワード認証無しでSSH接続しようとしたが、少しつまづいた。
今回は、RHEL9.4のEC2にパスワード認証無しでSSH接続するための手順について解説する。

環境

  • AWS
  • RHEL9.4
バージョン
# cat /etc/redhat-release ;date
Red Hat Enterprise Linux release 9.4 (Plow)
#

最初に実施した設定

下記設定を実施したが、SSH接続できず。

1./etc/ssh/sshd_configの下記設定をNoYes にする。

  • 設定前
PasswordAuthentication no
  • 設定後
PasswordAuthentication yes

2.sshdの再起動

コマンド
systemctl restart sshd
systemctl status sshd

対処

/etc/ssh/sshd_config.d/50-cloud-init.confも設定修正する必要有り
※AmazonLinuxでは、この対処は不要とのこと。

1./etc/ssh/sshd_config.d/50-cloud-init.conf修正

  • 設定前
PasswordAuthentication no
  • 設定後
PasswordAuthentication yes

2.sshdの再起動

コマンド
systemctl restart sshd
systemctl status sshd

参考

https://qiita.com/supermasaya11/items/b4898710408113453017

https://repost.aws/ja/questions/QUE9_NBn5MQ5KgpjVyyy3ISA/unable-to-login-with-username-and-password-in-redhat-machine-created-in-aws

Discussion