Cannot SSH into newly launched Rocky Linux 9.1 on AWS

After launching a new instance on AWS with image “Rocky Linux 9 (Official) - x86_64 Ver 9.1.20230215”, I cannot SSH into the instance with user “rocky” and the private key. Tried different SSH keys (RSA, ed25519, with length 2048, 3072) as suggested in this post but none worked:

This is reproducible when I retried launching new instances. I detached the EBS volume then attached it to a CentOS Stream 9 instance, and saw file /home/rocky/.ssh/authorized_keys is actually empty. Bug?

Anyone may feel free to try it on AWS and see.


I just launched a t3.medium instance from that image with the following key:

# ssh-keygen -lf ~/.ssh/ord-dev-neil.pem
2048 SHA256:0MURaygO9XG7T4KTGTiFcg6vUzHQskxclSy3WSldh9A no comment (RSA)

I then ssh’d to this instance:

# ssh -i ~/.ssh/ord-dev-neil.pem rocky@
Warning: Permanently added '' (ED25519) to the list of known hosts.
[rocky@ip-172-31-34-82 ~]$ sudo ls -altr /root/original-ks.cfg
-rw-------. 1 root root 5289 Feb 15 18:06 /root/original-ks.cfg
[rocky@ip-172-31-34-82 ~]$

How are you supplying the key to the image?

Thanks for the quick reply. The keys were generated from AWS console launching config page. I’ll try again.

Now it worked. Strange - maybe an AWS provision glitch. I’ll post back if it happens again. Thanks you!

1 Like