Why does my connection to an Amazon Linux 2023 instance fail when using an RSA key?

PROBLEM DESCRIPTION or QUESTION


Attempting to connect to an Amazon Linux 2023 instance with an RSA key fails.

RESOLUTION


Relatively newer Linux distributions tend to prohibit RSA keys (specifically the ssh-rsa algorithm) by default. This is for security reasons. This is the case for Amazon Linux 2023 as well. The following document from Amazon guides you through host keys, but the same applies to private keys as well.

https://docs.aws.amazon.com/linux/al2023/ug/ssh-host-keys-disabled.html

 

You can follow the guide below to either choose the ED25519 key format or enable the ssh-rsa algorithm. However, for security reasons, the latter is not recommended and we strongly encourage you to use ED25519.

 

After generating an ED25519 or ECDSA key in Xshell, you can follow the guide below to register the corresponding public key on the server.