Resetting the Password of a Windows ECS by Attaching a System Disk to a Temporary ECS

Scenarios

You can reset your ECS password if:

The method described in this section can only be used to change the password of a local Windows account; it cannot be used to change a domain account password.

Prerequisites

Procedure

  1. Stop the original ECS and detach the system disk.
    1. Log in to the management console.
    2. Click in the upper left corner and select a region and project.
    3. Under Computing, click Elastic Cloud Server.
    4. 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.

    5. Locate the row containing the system disk and click Detach to detach the system disk from the ECS.
  2. Attach the system disk to the temporary ECS.
    1. On the details page of the temporary ECS, click the Disks tab.
    2. Click Attach Disk. In the displayed dialog box, select the system disk detached in step 1.e and attach it to the temporary ECS.
    3. Remotely log in to the temporary ECS.
    4. Run the following command to query the system disk partitions attached to the temporary ECS, so you can identify the directory of the system disk:

      fdisk -l

    5. Run the following command to mount the file system of the detached system disk to the temporary ECS:

      mount -t ntfs-3g /dev/<system-disk-directory> /mnt/

      For example, if the queried system disk directory is xvde2, run the following command:

      mount -t ntfs-3g /dev/xvde2 /mnt/

      If the error information below is returned in the command output, the NTFS file systems between the original Windows ECS and the Linux ECS may be inconsistent.

      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.

      If the file system is inconsistent, back up the disk data first, and run the following command to repair the New Technology File System (NTFS) partition, and then attach the system disk:

      ntfsfix /dev/system-disk-directory

      For example, if the queried system disk directory is xvde2, run the following command:

      ntfsfix /dev/xvde2

  3. On the temporary ECS, change the password of the specified user and clear the original password.
    1. Run the following command to back up the SAM file:

      cp /mnt/Windows/System32/config/SAM /mnt/Windows/System32/config/SAM.bak

    2. Run the following command to change the password of the specified user:

      chntpw -u Administrator /mnt/Windows/System32/config/SAM

    3. 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
  4. Stop the temporary ECS, detach the system disk, and attach the system disk back to the original Windows ECS.
    1. Stop the temporary ECS, go to the ECS details page, and click the Disks tab.
    2. Click Detach to detach the system disk temporarily attached in 2.b.
    3. On the details page of the original Windows ECS, click the Disks tab.
    4. Click Attach Disk. In the displayed dialog box, select the system disk detached in step 4.b and attach it to the original ECS as the system disk.
  5. Start the original Windows ECS and set a new login password.
    1. Click Start to start the original Windows ECS. After the status becomes Running, click Remote Login in the Operation column.
    2. Click Start. Enter CMD in the search box and press Enter.
    3. Run the command below to set a new password. The new password must meet the password complexity requirements. For details, see Overview of Password Reset.

      net user Administrator <new-password>