码迷,mamicode.com
首页 > 系统相关 > 详细

重置VMware ESXi Root Password

时间:2018-03-01 17:29:50      阅读:251      评论:0      收藏:0      [点我收藏+]

标签:VMware ESXi Password

Lost or forgot the root password of VMware ESXi host? Is there any way to recover or reset it? Just like many Linux distributions, VMware ESXi also stores user account information, including one-way encrypted passwords, in a file called /etc/shadow. Just boot your server with a Linux Live CD and you can remove the root password easily.

This tutorial explains how to use Ubuntu Live CD to reset forgotten root password on VMware ESXi 5.5, so you can log back into your ESXi server without reinstalling.

How to Reset VMware ESXi Root Password with Ubuntu Live CD?

  1. Boot your ESXi server from Ubuntu Live CD. After a while, the system installer will appear with the option to "Try Ubuntu" or "Install Ubuntu". Click on "Try Ubuntu" to load Ubuntu directly into RAM, without installing it on your hard drive.

    技术分享图片

  2. After getting to the Ubuntu desktop, click on the Ubuntu icon in the upper left corner and search forGParted in the Dash. Double-click on GParted Partition Editor to launch it.

    技术分享图片

  3. Look at the partition layout of ESXi 5. The actual hypervisor/system image is located on the first 250 MB partition (/dev/sda5) which contains the state.tgz file.

    技术分享图片

  4. Now that we know that the partition which we need to mount is /dev/sda5, close GParted and open the Terminal.

    技术分享图片

  5. In terminal, type "sudo -s" to gain root access and then mount the ESXi system partition with the following commands. After mounting, you'll see the state.tgz file that we need to unpack now.

    sudo -s
    mount /dev/sda5 /mnt
    cd /mnt
    ls


    技术分享图片

  6. Copy state.tgz to the /tmp folder, and then unpack the state.tgz file which contains another compressed archive named local.tgz.

    cp  state.tgz  /tmp
    cd  /tmp
    tar xzf  state.tgz
    ls


    技术分享图片

  7. Unpack the local.tgz file which has the /etc directory compressed in it.

    tar  xzf  local.tgz
    ls


    技术分享图片

  8. Go to the /etc directory and you can gain access to the shadow file which contains the password hash of ESXi root account.

    技术分享图片

  9. Run the vi shadow command to open the shadow file in the vi editor. You'll find out that the password hash of the root account is surrounded by the first two colons. To remove the existing root password, you need to delete the password hash.

    技术分享图片

  10. Once you have removed the password hash, press ESC to return to the command mode. Type in :wqand press Enter. This will save your changes and exit the vi editor.

    技术分享图片

  11. Re-pack the files and copy the modified state.tgz file back to the ESXi system partition with the following commands:

    cd ..
    tar czf  local.tgz  etc
    tar czf  state.tgz  local.tgz
    cp  state.tgz  /mnt/
    umount  /mnt


    技术分享图片

  12. We’re almost done! Just type reboot then remove the live CD and wait for ESXi server to restart. After a while, you'll get the following screen where you can configure the system by pressing F2.

    技术分享图片

  13. Just keep the password field blank and you can log into the root account.

    技术分享图片

  14. Please make sure that you set a new root password and store it confidentially. Do not lose it again.

    技术分享图片

Now you've successfully reset lost root password on VMware ESXi host. The procedure is a bit complicated so carefully follow the instructions above. Enjoy it!


重置VMware ESXi Root Password

标签:VMware ESXi Password

原文地址:http://blog.51cto.com/aixer95/2074279

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!