Go back to Knowledge Base
It could sometimes happen that you do not know or remember the password that was set for the Root (Admin) account on your ESXi server. To reset the password, you will need to get physical access to the server, in order to boot on a CD. By using this solution, you will set a blank password for the Root account.
I found the solution in an article from http://wm-help.com and decided to share it on this website. This is always very good to share with people and write it in a second place, in order to be sure to find the information on the web when you need to access it again.
When running ESXi, it is not possible to boot using single user mode, this is why this procedure is needed.
You can use any Linux boot CD, on order to access systems file. On solution is to download Slax Linux Live CD.
In order to set a blank password, you need to follow these steps:
|
|
Operation |
Description |
| 1. |
|
Linux Boot |
Boot on a Linux CD and launch the command line interface |
| 2. |
|
fdisk -l |
List the different volumes |
| 3. |
|
ls -l /mnt/sda5/ |
Find the location of state.tgz or local.tgz file. If this file is not present on sda5, repeat the command on others volumes. |
| 4. |
|
cd /tmp |
Move to tmp folder |
| 5. |
|
cp /mnt/sda5/state.tgz state.tgz |
Copy the file to tmp folder |
| 6. |
|
cp /mnt/sda5/state.tgz state.bkp |
Make a backup of the file in tmp folder, just in case you need to recover it later |
| 7. |
|
gzip -d state.tgz |
Uncompress state.tgz |
| 8. |
|
tar -xvf state.tar |
Extract state.tar |
| 9. |
|
gzip -d local.tgz |
Uncompress local.tgz |
| 10. |
|
tar -xf local.tar |
Extract local.tar |
| 11. |
|
cd etc |
Move into etc folder |
| 12. |
|
vi shadow |
Edit shadow file (i for insert, esc to exit editing mode, :wq to save and exit) |
| 13. |
|
root::13358:0:99999:7::: |
Edit the first line with these information, in order to have a blank password |
| 14. |
|
:wq |
Save and exit |
| 15. |
|
cat shadow |
Verify the saved information |
| 16. |
|
cd .. |
Move into upper folder |
| 17. |
|
tar -czf local.tgz etc |
Create local.tgz archive |
| 18. |
|
tar -czvf state.tgz local.tgz |
Create state.tgz archive |
| 19. |
|
ls -l /mnt/sda5/ |
List volume content and check date & time of state.tgz file |
| 20. |
|
cp state.tgz /mnt/sda5/state.tgz |
Copy the file with blank password to the original location |
| 21. |
|
ls -l /mnt/sda5/ |
List volume content and check date & time of state.tgz file, to verify you have copied the new file |
| 22. |
|
ESXi Boot |
Boot on ESXi |
| 23. |
|
Logon with Root account |
Logon with Root account and reset the password to what you want |
I hope it will help you to gain access on your system when you lost your password.
Enjoy it and do not forget to provide any feedback.
Go back to Knowledge Base
- Details
-
Written by Nicolas Buache
-
Created on Saturday, 07 January 2012
-
Last Updated on Sunday, 08 January 2012
-
Hits: 549