If you did not set a logon password when you created an Elastic Compute Service (ECS) instance or if you forget the logon password of an ECS instance, you can use the password reset feature to change the password or set a logon password for the instance. This topic describes how to reset the logon password of an ECS instance in the ECS console.

Prerequisites

The ECS instance whose logon password you want to reset is in the Running or Stopped state.

Background information

This topic focuses on how to reset the logon password of an ECS instance in the ECS console. You can also use Cloud Assistant to reset the logon password of an ECS instance, or connect to an ECS instance and reset the logon password on the instance. The following table compares the different methods to reset the logon password of an ECS instance.
MethodDescriptionReferences
Reset the logon password of an ECS instance by using the ECS console
  • Reset the logon password of an ECS instance offline
    • The instance must be in the Running or Stopped state.
    • You do not need to log on to the instance.
    • After you reset the password, you must start or restart the instance for the new password to take effect.
      Warning The restart operation stops the instance for a short period of time and may interrupt services that are running on the instance. We recommend that you restart instances during off-peak hours.
  • Reset the logon password of an ECS instance online
    • The instance must be in the Running state.
    • You do not need to log on to the instance.
    • After you reset the password, you do not need to start or restart the instance for the new password to take effect.
Note If you want to reset the logon password of an ECS instance online, make sure that the following requirements are met:
  • You use an Alibaba Cloud account instead of a Resource Access Management (RAM) user to perform the password reset operation.
  • The instance resides in a virtual private cloud (VPC). Instances that reside in VPCs can have their passwords reset online, whereas instances that reside in the classic network cannot.
  • Key Management Service (KMS) is activated. KMS can be activated free of charge.
  • No RAM roles are attached to the instance.
  • The Cloud Assistant Agent is installed on the instance.
The Procedure section in this topic
Reset the logon password of an ECS instance by using Cloud Assistant
  • The instance must be in the Running state.
  • You do not need to log on to the instance.
  • After you reset the password, you do not need to restart the instance for the new password to take effect.
Change the logon password of an instance
Connect to the instance and reset its logon password on the instance
  • The instance must be in the Running state.
  • You must connect to the instance. The procedure to connect to an instance is complex.
  • After you reset the password, you do not need to restart the instance for the new password to take effect.
Change the logon password of an instance by connecting to the instance

Considerations

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

  • Choose an appropriate time to reset the logon password. If the instance is in the Running state, you must restart the instance after the logon password is reset offline for the new password to take effect. The instance restart may affect your business. We recommend that you reset the password during off-peak hours to minimize the impact on business.
  • The key pair authentication method overrides the username-password authentication method. Linux instances can be logged on to by using key pairs or by using usernames and passwords. If you bind a key pair to a Linux instance that already has a logon password, the password becomes invalid and you can only use the key pair to log on to the instance. If you want to use a password to log on to the Linux instance, you must reset the 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 logon passwords you want to reset at a time:
    • To reset the logon 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 Instance Password below the instance list.. Reset the password of multiple instances at a time
  5. In the Reset Instance Password dialog box, set Methods to reset the password to Reset Online or Reset Offline as needed. Enter a password in the Logon Password and Confirm Password fields and click Save Password.
    The entered password must be 8 to 30 characters in length and contain at least three of the following character types:
    • Uppercase letters
    • Lowercase letters
    • Digits
    • Special characters. The supported special characters include ( ) ` ~ ! @ # $ % ^ & * - _ + = | { } [ ] : ; ' < > , . ? /
    Note For Windows instances, logon passwords cannot start with a forward slash (/).

    The following table describes the differences between resetting a password online and resetting a password offline.

    Method to reset a passwordDescription
    Reset a password onlineAfter you reset the logon password of an instance online, the new password is expected to take effect in 1 minute. You can go to the Operation Orchestration Service (OOS) console and click Executions in the left-side navigation pane to view the execution result of the password reset task.
    Reset a password offlineAfter you reset the logon password of an instance offline, perform one of the following operations based on the instance state for the new password to take effect:
    • If the instance is in the Running state, click Restart Now.
    • If the instance is in the Stopped state, the new password takes effect immediately when you start the instance.