You need to enable JavaScript to run this app.
Elastic Compute Service

Elastic Compute Service

Copy page
Download PDF
Passwords and key pairs
Resetting login password
Copy page
Download PDF
Resetting login password
Scenarios​
If you have forgotten the login password for an instance, or did not specify a password when you create an instance, you can refer to this topic and select an appropriate method to specify the login password for one or more instances.​
tip​
  • Only Linux instances support SSH key pair-based login. Windows instances do not support this login method.​
  • If a Linux instance is associated with an SSH key pair, after you reset the password, you can log in to the instance by using the password or the key pair.​
Comparison of password reset methods​
The following table describes the login password reset methods for instances. Select a suitable method based on your business requirements.​
warning​
  • If you first change the login password to A by using the offline reset method without restarting the instance, and then reset it to B by using the online reset method and restart the instance, the password that actually takes effect is A.​
  • If you use a custom account and want to log in to your instance with a custom username, refer to Method 1 (Linux instances only) or Method 4.​
​
Reset method​
Recommended scenarios​
Instance state​
Installation of reset-authentication plug-in required​
Installation of cloud assistant Agent required​
Instance login required​
Instance restart required​
Batch operation supported​
You can reset the password for the root user or a custom user of Linux instances.​
In service​
No​
Yes​
Not required​
Not required​
Not supported​
You can reset the password for the root user of Linux instances and the Administrator user of Windows instances.​
Running or Stopped​
Yes​
Not required​
Not required​
Yes​
Supported​
For instances without the reset-authentication plug-in installed, we recommend that you use this method to reset the password.​
In service​
Not required​
Yes​
Not required​
Not required​
Supported​
Reset the password for a custom user.​
In service​
Not required​
Not required​
Yes​
Not required​
Not supported​
​
Method 1: Reset the instance login password online​
Limits​
​
Limit item​
Description​
Cloud assistant Agent​
To reset the password online, you need to install the cloud assistant Agent. Make sure that the cloud assistant Agent is running and that its version is not earlier than 1.11.1.​
Instance state​
The instance must be in the Running status.​
Operating System​
You cannot reset the login password online for Windows instances.​
Batch operation​
You cannot reset the password online for multiple instances at the same time.​
​
Procedure ​
  1. Log in to the ECS console.​
  1. In the top menu bar, select the region and project of the target instance.​
  1. Click the "... > Instance property > Reset instance password" button in the "Actions" column on the right side of the target instance.​
  1. Select "Reset Password Online" as the reset method. Then enter the username (default: root) and the new password.​
  1. Click the "Reset" button and wait for the reset process to finish.​
tip​
  • During the reset process, a temporary key pair is generated by the cloud assistant to encrypt the password, ensuring the security of the password during transmission. The temporary key pair is automatically deleted after 60 seconds.​
  • After you reset the password by using this method, you do not need to restart the instance. The new password takes effect immediately.​
  1. (Optional) If the operation fails, you can go to the cloud assistant management page to view task details. Learn more.​
Method 2: Reset the instance login password offline​
Usage notes​
​
Type​
Description​
Instance related​
The instance status must be Running or Stopped.​
​
After you reset the password, you need to restart the instance for the new password to take effect.​
​
A newly created instance must run for several minutes before you can reset the password offline. Attempting to reset the password immediately after creation results in an error.​
Image-related​
For Windows instances, take note of the following items. Otherwise, the reset fails. Proceed with caution.​
  • Before you reset the password, do not frequently start up or shut down the target instances.​
  • After you reset the password and restart the instances, we recommend that you do not restart or shut down any Running instance again within 10 minutes.​
​
Before you reset the password for an instance created by using a custom image, you need to install the reset-authentication plug-in. Otherwise, the reset fails.​
Batch operation​
When you reset the password offline for multiple instances at the same time, you can select up to 100 instances at a time. If password reset submission fails for any instance in the batch, the batch operation cannot be performed. Follow the onscreen instructions to complete the required steps and try again, or select individual instances to reset their passwords separately.​
​
Procedure ​
  1. Log in to the ECS console. ​
  1. In the top menu bar, select the region and project of the target instance.​
  1. On the Instances page, use one of the following methods to go to the password reset page.​
  • Reset the password for a single instance: In the "Actions" column to the right of the target instance, click "... > Instance property > Reset instance password".​
  • Reset the password for multiple instances at the same time: Select one or more instances for which you want to reset the password, and click "... > Reset instance password".​
  1. Select "Reset Password Offline" as the reset method and enter the new password.​
  1. Select "Agree to restart Instances now" to make the operation take effect. You can also manually restart the instances after the operation is complete.​
tip​
If you select "Agree to restart Instances now", your business is interrupted. Proceed with caution.​
After selecting immediate restart, the Running ECS instances will restart by default, and the Stopped ECS instances will start by default.​
  1. Click "Confirm" to complete the procedure.​
  1. (Optional) After the instance restarts, you can use the new password to log in to the instances.​
Method 3: Use the cloud assistant to reset the password​
For information about how to use the cloud assistant to reset the login password for instances, see Modifying login passwords for multiple instances at the same time/Adding SSH public key.​
Method 4: Reset the password within an instance​
For information about how to reset the login password for a custom account within an instance, see Logging in to ECS instance with custom account.​
Related documents​
Last updated: 2026.09.11 19:20:17