If you did not configure a logon password when you created an Elastic Compute Service (ECS) instance or you forget the logon password of an ECS instance, you can use the password reset feature. This topic describes how to reset the logon password of an ECS instance in the ECS console.
Methods
Methods for resetting the logon password of an ECS instance
Method 1: Reset the logon password of an ECS instance in the ECS console
Log on to the ECS console.
In the left-side navigation pane, choose .
In the top navigation bar, select the region and resource group to which the resource belongs.
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 one instance, find the instance and choose
in the Actions column.To reset the logon password of multiple instances at a time, select the instances and choose
in the lower part of the Instance page.
In the Reset Instance Password dialog box, configure the parameters and click OK.
Parameter
Description
Logon Username
If you select the Online Reset method, you can specify a logon username and password or change the logon username and password that you specified when you created an ECS instance.
If you select the Offline Reset method, you can change the password that you specified when you created an ECS instance, but you cannot change the logon username.
New Password and Confirm Password
The password must be 8 to 30 characters in length and contain at least three types of the following characters:
Uppercase letters (A to Z)
Lowercase letters (a to z)
Digits (0 to 9)
Special characters:
( ) ` ~ ! @ # $ % ^ & * - _ + = | { } [ ] : ; ' < > , . ? /
NoteFor Windows instances, logon passwords cannot start with a forward slash (/).
Password Reset Method
Online Reset: After you reset the password of an ECS instance online, you do not need to restart the instance. The new password is expected to take effect within 1 minute. You cannot reset the passwords of multiple instances online.
ImportantIn this method, Cloud Assistant is used to encrypt and transfer the password text to prevent decryption and ensure password security.
Offline Reset: After you reset the password offline, you must restart or start the instance for the new password to take effect.
If the instance is in the Running state, click Restart Now.
WarningThe 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 the instance during off-peak hours.
If the instance is in the Stopped state, the new password takes effect when you start the instance.
SSH Password Authentication
This parameter is available only when Password Reset Method is set to Online Reset.
Enable: If you enable SSH Password Authentication, the system automatically sets the
PasswordAuthentication
parameter toyes
in the/etc/ssh/sshd_config
file. This allows you to connect to the instance by using SSH and log on with the specified password.Retain Original Settings: If you select this option, you can change only the logon password of the instance.
(Optional) Use the new password to log on to the ECS instance.
For more information, see Connect to an instance.
NoteAlthough a key pair is bound to the instance, you can use the new password to log on to the instance after you reset the password.
Method 2: Reset the logon password of an ECS instance by using Cloud Assistant
Log on to the ECS console.
In the left-side navigation pane, choose .
In the top navigation bar, select the region and resource group to which the resource belongs.
Click the ID of the instance whose logon password you want to reset to go to the Instance Details page.
Click the Remote Commands/Files tab and click Send Remote Commands.
Configure the parameters to reset the logon password. The following table describes the parameters. Use the default settings for other parameters.
Parameter
Description
Execution Plan
Select Immediate execution.
Command Type
Select a command type.
For Linux ECS instances, select Shell.
For Windows ECS instances, select Bat or PowerShell.
Command Content
The content of the command. In the Command Content field, enter one of the following commands based on the operating system of your instance to change the logon password:
Linux ECS instance:
echo "root:<yourPassword>"|chpasswd
Windows ECS instance:
net user "Administrator" "<yourPassword>"
NoteReplace <yourPassword> with a new password.
The password must be 8 to 30 characters in length. The password must contain at least three of the following character types: uppercase letters, lowercase letters, digits, and special characters. The password of a Windows server cannot start with a forward slash (/).
Click Run.
Method 3: Reset the logon password of an ECS instance from within the instance
When you perform operations in the operating system of an ECS instance, you can reset the logon password of the instance based on your business requirements without the need to log on to the ECS console. After you reset the password, the new password immediately takes effect without the need to restart the instance.
Reset the logon password of a Linux ECS instance
In this example, an ECS instance that runs Alibaba Cloud Linux 3.2104 LTS 64-bit is used. To reset the logon password of the Linux ECS instance, perform the following steps:
Connect to the Linux ECS instance.
For more information, see Connect to a Linux instance by using a password or a key.
Run the following command to reset the logon password:
sudo passwd <Username>
Enter a new password and press the
Enter
key.Re-enter the new password and press the
Enter
key.The following command output indicates that the logon password of the Linux ECS instance is reset.
Reset the logon password of a Windows ECS instance
In this example, an ECS instance that runs Windows Server 2019 is used. To reset the logon password of the Windows ECS instance, perform the following steps:
Connect to the Windows ECS instance.
For more information, see Connect to a Windows instance by using a password or key.
On the Windows desktop, right-click the icon and then select Run. In the Run window, enter
compmgmt.msc
and press theEnter
key.In the Computer Management window, choose
.Right-click a username, such as Administrator, and select Set Password.
In the Set Password for Administrator window, click Proceed. Enter a new password in the New Password field. Then, re-enter the new password in the Confirm Password field.
Click OK.
The following window indicates that the logon password of the Windows ECS instance is reset.