0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

[解決済]AMIからEC2を複製したらパスワード認証が出来なくなった。

0
Last updated at Posted at 2023-10-10

AMIからEC2を複製したら、パスワードログインができなくなった

DEV環境複製したいタイミングとかってあると思うんですけど、普通にAMIを作成してAMIから起動したらログインできなくなっちゃうんですよね。
新卒なので普通に何かぶっ壊したんじゃないかと焦りました。

原因と解決策

原因:
AMIを使用してEC2を立ち上げる際、/etc/ssh/sshd_configPasswordAuthenticationがデフォルトでnoに設定されているため。

解決策:

  1. EC2インスタンスにSSH接続する。
  2. sudo vim /etc/ssh/sshd_configを実行し、設定ファイルを開く。
  3. PasswordAuthentication noPasswordAuthentication yesに変更する。
# Before:
PasswordAuthentication no

# After:
PasswordAuthentication yes

SSHDサービスを再起動して変更を適用する。

 $ sudo service sshd restart

3. 所感

いや〜。まさか自動でPasswordAuthenticationがOFFになるとは思いもしませんでした。。。
いい勉強でした!!

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?