How Do I Reset the Password for Logging In to a Linux ECS?
Scenarios
This section describes how to reset the password of a Linux ECS by reattaching the system disk.
The method in this section only applies to x86 ECSs running CentOS 7, Ubuntu, or EulerOS.
Detaching the system disk from the ECS is involved. To prevent data loss, back up data in advance.
Prerequisites
- A temporary Linux ECS which locates in the same AZ as the target ECS is available.
- An EIP has been bound to the temporary ECS.
Procedure
- Stop the ECS, detach the system disk, and attach the system disk to the temporary ECS.
- Stop the ECS, go to its details page, and click the Disks tab.
Do not forcibly stop the ECS. Otherwise, password reset may fail.
- Locate the row containing the system disk to be detached and click Detach.
- Go to the details page of the temporary ECS, click the Disks tab.
- Click Attach Disk. In the displayed dialog box, select the system disk detached in step 1.b and attach it to the temporary ECS.
- Stop the ECS, go to its details page, and click the Disks tab.
- Log in to the temporary ECS remotely and reset the password.
- Locate the temporary ECS and click Remote Login in the Operation column.
- Run the following command to view the directory of the system disk previously detached but now attached to the temporary ECS:
Figure 1 Viewing the directory of the system disk
- Create a temporary directory and mount the system disk to it.
mount /dev/vdb1 /aaz
- Switch to the directory where the system disk is mounted.
Figure 2 Switching to the mount directory
- Run the following command and enter a new password as prompted:
If the following information is displayed, the password has been reset:
all authentication tokens updated successfully.
- Stop the temporary ECS, detach the system disk, attach the system disk back to the ECS, and restart the ECS.
- Stop the temporary ECS, switch to its details page, and click the Disks tab.
- Click Detach to detach the disk that is attached in step 1.
- On the details page of the ECS, click the Disks tab.
- Click Attach Disk. In the displayed dialog box, select the disk detached in step 3.b and device name /dev/sda.
- Restart the ECS.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot