AmazonLinux2022 ssh-rsa not in PubkeyAcceptedAlgorithms [preauth]の解決方法

環境
AmazonLinux2022

エラー現象
# tail -f /var/log/secure
xxx userauth_pubkey: key type ssh-rsa not in PubkeyAcceptedAlgorithms [preauth]

sshのバージョンを確認する
# ssh -V

対処方法
1.配置ファイルをコピーする

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# cp -p /etc/ssh/sshd_config /etc/ssh/sshd_config.org
# cp -p /etc/ssh/sshd_config /etc/ssh/sshd_config_$(date +%Y%m%d)
# cp -p /etc/ssh/sshd_config /etc/ssh/sshd_config.org # cp -p /etc/ssh/sshd_config /etc/ssh/sshd_config_$(date +%Y%m%d)
# cp -p /etc/ssh/sshd_config /etc/ssh/sshd_config.org
# cp -p /etc/ssh/sshd_config /etc/ssh/sshd_config_$(date +%Y%m%d)

2.sshd_configの先頭行等に PubkeyAcceptedAlgorithms=+ssh-rsa を書き込み、
ssh-rsaシグネチャを許可する

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# sed -i '1s/^/PubkeyAcceptedAlgorithms=+ssh-rsa\n/' /etc/ssh/sshd_config
# sed -i '1s/^/PubkeyAcceptedAlgorithms=+ssh-rsa\n/' /etc/ssh/sshd_config
# sed -i '1s/^/PubkeyAcceptedAlgorithms=+ssh-rsa\n/' /etc/ssh/sshd_config

3.sshdサービスの停止

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# systemctl stop sshd.service
# systemctl stop sshd.service
# systemctl stop sshd.service

4.sshdサービスの起動

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# systemctl start sshd.service
# systemctl start sshd.service
# systemctl start sshd.service

 

AWS

Posted by arkgame