Resetting the Password of a Windows ECS by Attaching a System Disk to a Temporary ECS
Scenarios
If no password was set when you create an ECS, or if the password has been lost or expired, you can reset it.
Generally, you can reset the password on the console. For details, see Resetting the Password for Logging In to an ECS on the ECS Console.
If the password cannot be reset on the console or the reset password does not take effect, the one-click password reset plug-in may be missing, the COC may not be enabled and authorized, or UniAgent may not be installed. In this case, you can reset the password by referring to this section.
This section only applies to Windows ECSs. For Linux ECSs, see Resetting the Password of a Linux ECS by Attaching a System Disk to a Temporary ECS.
Constraints
- The method described in this section only can be used to change the password of a local Windows account; it cannot be used to change a domain account password.
- The system disk needs to be detached. To prevent data loss of the system disk, back up the system disk or create a snapshot for the system disk first.
Prerequisites
- A backup or snapshot has been created for the system disk. For details, see Backing Up an ECS or Creating an EVS Snapshot.
- A temporary Linux ECS running Ubuntu 14.04 or later is available. It is located in the same AZ and has the same CPU architecture as the target ECS.
- You have bound an EIP to the temporary ECS and configured the apt-get source.
- You have used either of the following methods to install ntfs-3g and chntpw software packages on the temporary ECS:
Method 1:
Run the following command to install the ntfs-3g and chntpw software packages:
sudo apt-get install ntfs-3g chntpw
Method 2:
Download the ntfs-3g and chntpw software packages of the version required by the temporary ECS OS.
Process Flow

Procedure
- Stop the original ECS and detach the system disk.
- Log in to the management console.
- Click
in the upper left corner and select a region and project.
- Click
. Under Compute, click Elastic Cloud Server.
- Stop the original Windows ECS, switch to the ECS details page, and click the Disks tab.
Do not forcibly stop the Windows ECS. Otherwise, password reset may fail.
- Locate the row containing the system disk to be detached and click Detach to detach the system disk from the ECS.
- Attach the system disk to the temporary ECS.
- On 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.e and attach it to the temporary ECS.
- Remotely log in to the temporary ECS.
- Run the following command to view the directory of the system disk attached to the temporary ECS:
fdisk -l
- Run the following command to mount the file system of the detached system disk to the temporary ECS:
mount -t ntfs-3g /dev/Result obtained in step 2.d /mnt/
For example, if the result obtained in step 2.d is xvde2, run the following command:
mount -t ntfs-3g /dev/xvde2 /mnt/
If the following error information is returned in the command output, the NTFS file systems may be inconsistent. In such a case, rectify the file system inconsistency.
The disk contains an unclean file system (0, 0). Metadata kept in Windows cache, refused to mount. Failed to mount '/dev/xvde2': Operation not permitted The NTFS partition is in an unsafe state. Please resume and shutdown Windows fully (no hibernation or fast restarting), or mount the volume read-only with the 'ro' mount option.
Back up the disk data, run the following command to rectify the NTFS file system inconsistency, and attach the system disk:
ntfsfix /dev/Result obtained in step 2.d
For example, if the result obtained in step 2.d is xvde2, run the following command:
ntfsfix /dev/xvde2
- Change the password of the specified user and clear the original password.
- Run the following command to back up the SAM file:
cp /mnt/Windows/System32/config/SAM /mnt/Windows/System32/config/SAM.bak
- Run the following command to change the password of the specified user:
- Enter 1, q, and y as prompted, and press Enter.
The password has been reset if the following information is displayed:
Select: [q] > 1 Password cleared! Select: [q] > q Hives that have changed: #Name 0<SAM> Write hive files? (y/n) [n] : y 0<SAM> - OK
- Run the following command to back up the SAM file:
- Stop the temporary ECS, detach the system disk, and attach the system disk to the original Windows ECS.
- Stop the temporary ECS, go to the ECS details page, and click the Disks tab.
- Click Detach to detach the data disk temporarily attached in step 2.b.
- On the details page of the original Windows ECS, click the Disks tab.
- Click Attach Disk. In the displayed dialog box, select the data disk detached in step 4.b and attach it to the original ECS as the system disk.
- Start the original Windows ECS and set a new login password.
- Click Start to start the original Windows ECS. After the status becomes Running, click Remote Login in the Operation column.
- Click Start. Enter CMD in the search box and press Enter.
- Run the following command to set a new password. The new password must meet the password complexity requirements described in Application Scenarios for Using Passwords.
net user Administrator <new-password>
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