This topic describes how to reset the logon password of an Elastic Compute Service (ECS) instance. This topic is applicable to scenarios such as when you forget the password or when you did not set a password during instance creation.

Prerequisites

The instance is in a stable state, such as Stopped or Running. For more information about the state of an instance, see Instance lifecycle.

Background information

You can use one of the methods described in the following table to reset the logon password of an ECS instance.
Method Description References
Reset the logon password of an ECS instance in the console
  • Advantages: No need to log on to the instance.
  • Disadvantages: The instance must be restarted, which interrupts the services that are running on the instance.
This topic
Use Cloud Assistant to reset the logon password of an ECS instance Advantages: No need to log on to or restart the instance. Change the logon password of an instance
Log on to the ECS instance and reset the logon password
  • Advantages: No need to restart the instance.
  • Disadvantages: You must log on to the instance.
Change the logon password of an instance by connecting to the instance

Precautions

If you want to reset the logon password of an ECS instance in the console, take note of the following items:

  • After you reset the logon password of an instance that is in the Running state, you must restart the instance for the new password to take effect. When you restart the instance, your services may be affected. We recommend that you reset the logon password during off-peak hours to avoid service disruption.
  • If the instance is a Linux instance, you can log on to the instance by using the password or the key pair. If you only use the password for authentication, this authentication method becomes invalid after you attach a key pair to your instance. If you want to use both password-based and key-based authentication methods to log on to the instance, you must reset its logon password.

Procedure

  1. Log on to the ECS console.
  2. In the left-side navigation pane, choose Instances & Images > Instances.
  3. In the top navigation bar, select a region.
  4. Perform one of the following operations based on the number of instances whose passwords you want to reset at a time:
    • To reset the password of a single instance, find the instance and choose More > Password/Key Pair > Reset Password in the Actions column. Reset the password of a single instance
    • To reset the password of multiple instances at a time, select the instances and click Reset Password below the instance list. Reset the password of multiple instances at a time
  5. In the Reset Password dialog box, enter a valid new password and click OK.
  6. Perform one of the following operations for the new password to take effect based on the instance state:
    • If the instance is in the Running state, click Restart Now.
    • If the instance is in the Stopped state, click Cancel and manually restart the instance.

      If you click Restart Now, an error is displayed, which indicates that this operation is not supported while the instance is in the current state. However, the password is already reset and will take effect the next time the instance starts.