Incorrect Credentials for EC2 Recovery Server

Product version: 9.0

Last modified: 27 September 2019

Problem

When recovering files to an Amazon EC2 instance, the connection to the server fails for the default user with an error message stating that the credentials are incorrect.

Background

Every Amazon EC2 Linux instance launches with a default system user account with administrative access to the instance.

The name of the default user depends on the operating system. Refer to the Connecting to Your Linux Instance Using SSH topic for details. The default user password is the name of the Amazon EC2 instance.

An AMI provider can provide a custom default instance username. If your instance was launched from a custom AMI, contact the AMI provider to get the default username and password.

On a newly deployed Amazon EC2 instance, the password for the default user may be locked.

Solution

If you encounter the Incorrect credentials for EC2 Recovery Server error, check the status of your default user password with the following command:

passwd -S <default_username>

where <default_username> is the EC2 Linux default username.

If the output of the command contains L, the password is locked; if the output contains P or PS, the password exists; if the output contains NP, there is no password for the default user.

There are several ways to solve the problem of a locked password:

  • Remove the password of the default user. Perform the following command:

    sudo passwd -d <default_username>

    After the password is deleted, log in to the EC2 Linux recovery server with the private key.

  • Create a new password for the default user:

    1. Enable password authentication in the /etc/sshd_config file by adding the string: PasswordAuthentication yes

    2. Restart the sshd service:

      /etc/init.d/sshd restart

    3. Enter the command below and follow the command instructions:

      sudo passwd <default_username>

  • Create a new user with a password. Proceed as follows:

    1. Run the command:

      sudo useradd <new_username>

    2. Enter the command below and follow the command instructions to create a password for the newly created user:

      sudo passwd <new_username>