Reviewed-by: Hasko, Vladimir <vladimir.hasko@t-systems.com> Co-authored-by: guoyanyan <guoyanyan3@huawei.com> Co-committed-by: guoyanyan <guoyanyan3@huawei.com>
17 KiB
Resetting the Password for Logging In to a Windows ECS
Scenarios
You can reset your ECS password if:
- The password is forgotten.
- The password has expired.
The method described in this section can only be used to change the password of a local Windows account, but not the password of a domain account.
Prerequisites
- A temporary Linux ECS which runs Ubuntu 14.04 or later and locates in the same AZ as the target ECS is available.
- 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.
Procedure
- Stop the original ECS, detach the system disk from it, and attach the system disk to the temporary ECS.
- Log in to the management console.
- Click
in the upper left corner and select your region and project.
- Under Computing, click Elastic Cloud Server.
- Stop the original Windows ECS, switch to the page providing details about the ECS, and click the Disks tab.
- Locate the row containing the system disk to be detached and click Detach to detach the system disk from the ECS.
- On the page providing details about 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.
- Log in to the temporary ECS remotely and attach the system disk.
- Run the following command to view the directory of the system disk detached from the original Windows ECS now 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.a /mnt/
For example, if the result obtained in step 2.a is xvde2, run the following command:
mount -t ntfs-3g /dev/xvde2 /mnt/
If the following error information is displayed after the preceding command is executed, 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.a
For example, if the result obtained in step 2.a is xvde2, run the following command:
ntfsfix /dev/xvde2
- Run the following command to view the directory of the system disk detached from the original Windows ECS now attached to the temporary ECS:
- Change the password 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 a 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, switch to the page providing details about the ECS, and click the Disks tab.
- Click Detach to detach the data disk temporarily attached in step 1.g.
- On the page providing details about 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 device name /dev/sda.
- 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 change the password (the new password must meet the requirements described in Table 1):
net user Administrator New password
Table 1 Password complexity requirements Parameter
Requirement
Example Value
Password
- Consists of 8 to 26 characters.
- Contains at least three of the following character types:
- Uppercase letters
- Lowercase letters
- Digits
- Special characters: $!@%-_=+[]:./^,{}?
- Cannot contain the username or the username spelled backwards.
- Cannot contain more than two consecutive characters in the same sequence as they appear in the username. (This requirement applies only to Windows ECSs.)
YNbUwp!dUc9MClnv
NOTE:The example password is generated randomly. Do not use it.