It was an interesting task to reset windows 8 password on a machine running Ubuntu . When I tried to (re)mount the disk I got the following problem and after googling for a while I found that there was no viable solution but to reinstall windows. However I successfully reset the password by using the following techniques.
I removed hard disk from the windows computer and attached it to my laptop running Ubuntu 17.10. By default Ubuntu mounts new hard disk as read only (or if any error) and therefore I have to remount the disk as read-write but I got the following error during mounting.
Metadata kept in Windows cache, refused to mount. ..
Windows machine had errors or hibernated files and therefore did not allow to mount as read-write. I used the following commands (alternatively, please unmount all partitions if mounted auto by Linux) a couple of times to fix this.
sudo mount -t ntfs-3g -o remove_hiberfile /dev/sda5 ~/win8/ sudo ntfsfix /dev/sda5
After this I installed the command line tool by:
sudo apt install chntpw
Now first list the Windows users and then make password blank by:
cd ~/win8/Windows/System32/config/ sudo chntpw -l SAM sudo chntpw -u Administratör SAM
The funny part starts now. The administrator user was written with Swedish character ‘ö’ i.e Administratör and it was’nt recognized as in the last command above.
A work around is to use RID which is displayed when listing Windows users ( command : sudo chntpw -l SAM ).
sudo chntpw -u 0x01f5 SAM
From the menu shown after the above command choose the one with blanking password, press q and (yes) for saving changes.