ESXI忘記密碼怎么辦


首先.我們先說說官方建議:
在KB https://kb.vmware.com/s/article/1317898 中提到
ESXi 3.5, ESXi 4.x, ESXi 5.x and ESXi 6.x
Reinstalling the ESXi host is the only supported way to reset a password on ESXi. Any other method may lead to a host failure or an unsupported configuration due to the complex nature of the ESXi architecture. ESXi does not have a service console and as such traditional Linux methods of resetting a password, such as single-user mode
千言萬語匯成一句話.從3.5/4.x/5.x/6.x開始,只支持重新安裝來重置密碼.OK.這個方法我們不介紹了,因為這不是今天我們的重點,我們今天重點來介紹一下野路子…哈哈

接下來非官方的方法,野路子方法來一套.
如何用Live CD 來恢復ESXi root密碼?
可以選各種live cd,只要是linux的就成, 這里使用的是Ubuntu Live CD.從Live CD 啟動, 啟動后選"Try Ubuntu" , “Try Ubuntu” 不安裝.只是在內存中跑了一個Linux.(使用其它Linux也都可以.我用Centos livecd也做了測試很也很方便.)

進到Ubuntu 桌面, 查找 GParted ,雙擊666,不不不.雙擊打開 GParted Partition Editor

找到第一個 250 MB 分區(/dev/sda5) 這個分區里包括了state.tgz文件.
fdisk -l也可以看到.


打開terminal把/dev/sda5掛到一個掛載點上.

掛載后,就可以看到state.tgz文件了
sudo -s
mount /dev/sda5 /mnt
cd /mnt
ls

復制state.tgz文件並解壓.准備做更改
cp state.tgz /tmp
cd /tmp
tar xzf state.tgz
ls


解壓后得到loca.tgz文件.然后再次解壓 local.tgz 文件就會得到etc目錄
tar xzf local.tgz
ls


進入到etc目錄找到 shadow文件

運行命令 vi shadow, 編輯文件刪除掉"root:要刪除的內容:" 紅線標的內容

保存文件.

重新打包文件local.tgz和state.tgz文件.並復制回掛載點.
cd …
tar czf local.tgz etc
tar czf state.tgz local.tgz
cp state.tgz /mnt/
umount /mnt


重啟主機從ESXi安裝盤啟動.啟動好后按F2

見證奇跡的時刻到了…直接空密碼回車.

DCUI進來了.配置密碼就好啦.

然后密碼這次得記好了吧…別再忘啦.再忘了還得這么來一套…
第二種方法非官方方法.不被官方支持.建議使用第一種官方建議方法來恢復密碼.
————————————————
原文鏈接:https://blog.csdn.net/csdn_lidp/article/details/83412756


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM