All Products
Search
Document Center

:The key system user does not exist in the Linux instance

Last Updated:May 20, 2022

Problem description

The key system user information in the Linux instance is lost. As a result, you cannot log on to the Linux instance.

Solutions

Take note of the following items:

  • Before you perform high-risk operations such as modifying instance configurations or data, we recommend that you check the disaster recovery and fault tolerance capabilities of the instances to ensure data security.
  • You can modify the configurations and data of instances including ECS and ApsaraDB RDS instances. We recommend that you create snapshots or enable RDS log backup before you modify instance configurations or data.
  • If you have authorized or submitted sensitive information such as the logon account and password in Alibaba Cloud, we recommend that you modify the information in a timely manner.

In the Linux, the /etc/passwd file stores the basic information of all users in the system, while the /etc/shadow file stores the password information of the system users. If critical system user information is lost, users may not be able to log in to the instance. In this case, you need to restore the information about the /etc/passwd and /etc/shadow configuration files. The following steps are used to restore system user information:

  1. Detach the system disk of the abnormal ECS instance and attach the disk as a data disk to the normal ECS instance. For more information, see How to log on to an abnormal system disk by attaching it to an ECS instance as a data disk.
  2. Log on to the normal ECS instance, switch to the root user, and run the following commands in sequence to back up the old etc/passwd and /etc/shadow files.
    cp /etc/passwd /etc/passwd.bak
    cp /etc/shadow /etc/shadow.bak
  3. Execute the following command to replace the old configuration file with the /etc/passwd- and /etc/shadow- configuration file.
    cp /etc/passwd- /etc/passwd
    cp /etc/shadow- /etc/shadow
  4. For more information, see Step 5 in How to log on to an abnormal system disk by attaching it to an ECS instance as a data disk to restore the system disk of an abnormal ECS instance.
  5. Remotely log on to the repaired ECS instance and confirm that the ECS instance is back to normal.

Applicable scope

  • ECS