What's the AMI default root password?

I just launched the official AMI (ami-04befdb203b4b17f6) on EC2, and by default it comes with only a root user AFAICT. That’s fine, but when I go to login I get a password prompt:

$ ssh root@123.456.789.123
Password: 

What’s the default root user password? Also there should probably be a security warning somewhere advising people to change the root password and set services.openssh.permitRootLogin = "no";.

1 Like

Based on https://github.com/NixOS/nixpkgs/blob/35b89f31e380d428dcb83563812d69cdcf11178c/nixos/modules/virtualisation/amazon-image.nix#L134-L137, it looks like ssh root@<ip...> only works with the special SSH key that was used when the instance was created. Eg, you have to instead run ssh -i ~/path_to_key.pem root@<ip...>.

Adding my experience: created a NixOS 21.05 AMI instance (from NixOS-21.05.740.aa576357673-x86_64-linux - ami-069a0ca1bde6dea52), tried to log in with ec2-user (as described in the docs), and was greeted with the Password: prompt as well:

$ ssh -i my.pem ec2-user@ec2-...com
Password:

In my case the solution was using root user instead:

$ ssh -i my.pem root@ec2-...com
[root@ip-172-31-4-245:~]#
2 Likes

We should probably document all this stuff somewhere…

1 Like