首頁 > 軟體

Linux清除Windows密碼

2020-06-16 16:42:51

記錄在Linux下清除Windows密碼的過程。

下載安裝ntfs-3g

  • 下載驅動讓Linux掛載Windows磁碟

https://tuxera.com/opensource/ntfs-3g_ntfsprogs-2017.3.23.tgz

  • 安裝

tar -xvf ntfs-3g_ntfsprogs-2017.3.23.tgz
cd ntfs-3g_ntfsprogs-2017.3.23
./configure
make
make install

下載安裝chntpw

  • 下載chntpw

https://pkgs.org/download/chntpw
wget http://li.nux.ro/download/nux/dextop/el7/x86_64//chntpw-0.99.6-22.110511.el7.nux.x86_64.rpm
yum -y install ./hntpw-0.99.6-22.110511.el7.nux.x86_64.rpm

掛載windows磁碟

  • 掛載windows的系統磁碟
    預設第二個分割區才是C槽

mkdir /win
mount -t  ntfs-3g /dev/xvdb2 /win

  • 備份SAM檔案

cd /win/Windows/System32/config/
cp SAM{,.bak}

  • 清除Windows密碼

chntpw SAM
User Edit Menu:
 1 - Clear (blank) user password
 2 - Edit (set new) user password (careful with this on XP or Vista)
 3 - Promote user (make user an administrator)
(4 - Unlock and enable user account) [seems unlocked already]
 q - Quit editing user, back to user select
Select: [q] > 1                        # 1 清除密碼
Password cleared!
Hives that have changed:
 #  Name
 0  <SAM>
Write hive files? (y/n) [n] : y        # y儲存
 0  <SAM> - OK

  • 將Windows系統磁碟重新掛載回windows中即可

IT145.com E-mail:sddin#qq.com