terça-feira, dezembro 17, 2024

Oracle OCI - Lost Windows Instance Password

1. Create a Ubuntu Instance and Connect via SSH

2. For the Windows Instance

Stop the Windows Instance.
Detach the Boot Volume.


3. Attach the Boot Volume to the Ubuntu Instance

Attach the detached Windows boot volume as a block volume in the Ubuntu instance.
Set the attachment type to iSCSI and Read/Write access.

4. Copy iSCSI Commands & Information
Copy the iSCSI commands and connection details provided when attaching the volume. These commands will be used later on the Linux instance.




Run the command in the Linux:



5. In the Linux (Ubuntu) Instance
Perform the following steps to recover and reset the Windows instance credentials:

a. List Volumes:
sudo sfdisk -l /dev/sdb

b. Fix NTFS Issues:
Identify the partition with NTFS issues (e.g., /dev/sdb4, typically shown as "Microsoft basic data").
$sudo ntfsfix /dev/sdb4

c. Create a Directory to Mount the Partition:
$sudo mkdir -p /media/windows

d. Mount the Partition:
$sudo mount /dev/sdb4 /media/windows

e. Update Your System:
$sudo apt update

f. Install chntpw:
$sudo apt install chntpw

g. Run chntpw to Clear or Reset Passwords:
Use chntpw to modify the Windows user passwords.
Clear the user password:
$chntpw /media/windows/Windows/System32/config/SAM -u opc
Select the option 1 to clear the password
Allow black passwords
chntpw -e /media/windows/Windows/System32/config/SYSTEM
>cd ControlSet001\Control\Lsa\
>ed LimitBlankPasswordUse
>0x0



6. Unmount the Volume

$sudo umount /media/windows

7. Disconnect the iSCSI Connection

Run the commands you copied earlier when attaching the iSCSI volume (for diconnect).

8. Reattach the Boot Volume to the Windows Instance

Detach the volume from the Ubuntu instance.

Reattach it to the original Windows instance.

9. Access the Windows Instance

You should now be able to connect to the Windows instance using RDP without a password.

Modify both the opc user and the Administrator user settings.
If the Administrator account is disabled, enable it during the process (use chntpw).
Making changes to both accounts ensures accessibility.
Better safe than sorry!

Nenhum comentário: