{"id":18,"date":"2023-11-13T09:23:34","date_gmt":"2023-11-13T09:23:34","guid":{"rendered":"https:\/\/nguyenhieu.name.vn\/?p=18"},"modified":"2023-11-15T02:34:10","modified_gmt":"2023-11-15T02:34:10","slug":"reset-vmware-esxi-root-password","status":"publish","type":"post","link":"https:\/\/nguyenhieu.name.vn\/?p=18","title":{"rendered":"How to reset VMware ESXi root password"},"content":{"rendered":"\n<p>There is no default root password in VMware ESXi, so when you log in ESXi, you are required to enter your IP address, root name and password first. You&#8217;d better write down your root password to cope with the following scenarios:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Upgrade VMware ESXi.<\/li>\n\n\n\n<li>vCenter goes haywire and is inaccessible and requires the local root account remains for authentication.<\/li>\n<\/ul>\n\n\n\n<p>If you forget your password and don&#8217;t want to reinstall your ESXi hosts, what should you do? Remember to take a\u00a0backup or snapshot\u00a0before you start again to avoid data loss due to the risk of operation.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Reset VMware root password by editing the \u201cshadow\u201d file<\/h2>\n\n\n\n<p>If it\u2019s not available for you to use vCenter to reset your password, you can try another method:&nbsp;<strong>use a Live Linux CD\/DVD\/USB<\/strong>&nbsp;to reset VMware root password. ESXi saves the root password encrypted in a password file located in&nbsp;<strong>\/etc\/shadow<\/strong>&nbsp;. I will remove the password hash in located in 2 partitions in order to create a new password in the DCUI console.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Download a live Linux CD\/DVD, and I choose the Gparted LiveCD.<\/li>\n<\/ol>\n\n\n\n<p>2. Burn a USB or CD\/DVD with the Live CD\/DVD and boot your host off it.<\/p>\n\n\n\n<p>3. Locate the 2 partitions sized 249.98MB. The \/dev\/sda5 and \/dev\/sda6 are what we\u2019re after assuming you installed ESXi on the first available hard drive\/ssd. This could differ if, for example, you installed ESXi on a USB device or SD card. We will be editing the \/dev\/sda5 partition first followed by the \/dev\/sda6.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"747\" height=\"312\" src=\"https:\/\/nguyenhieu.name.vn\/wp-content\/uploads\/2023\/11\/image.png\" alt=\"\" class=\"wp-image-19\" srcset=\"https:\/\/nguyenhieu.name.vn\/wp-content\/uploads\/2023\/11\/image.png 747w, https:\/\/nguyenhieu.name.vn\/wp-content\/uploads\/2023\/11\/image-300x125.png 300w\" sizes=\"auto, (max-width: 747px) 100vw, 747px\" \/><\/figure>\n\n\n\n<p>4. Open a terminal window and run the following commands in the exact order as listed.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Run these commands to get to the shadow password file.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo su<br>mkdir \/boot \/temp<br>mount \/dev\/sda5 \/boot<br>cd \/boot<br>cp state.tgz \/temp<br>cd \/temp<br>tar -xf state.tgz<br>tar -xf local.tgz<br>rm *.tgz<br>cd etc<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"472\" height=\"371\" src=\"https:\/\/nguyenhieu.name.vn\/wp-content\/uploads\/2023\/11\/image-1.png\" alt=\"\" class=\"wp-image-20\" srcset=\"https:\/\/nguyenhieu.name.vn\/wp-content\/uploads\/2023\/11\/image-1.png 472w, https:\/\/nguyenhieu.name.vn\/wp-content\/uploads\/2023\/11\/image-1-300x236.png 300w\" sizes=\"auto, (max-width: 472px) 100vw, 472px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Then use vi to edit the shadow password file.<\/li>\n<\/ul>\n\n\n\n<p>Just move to the line starting with the root and delete the string between the first 2 colons. Use the\u00a0<strong>Delete<\/strong>\u00a0key. When done, enter\u00a0<strong>:wq<\/strong>\u00a0followed by\u00a0<strong>Enter<\/strong>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"402\" height=\"202\" src=\"https:\/\/nguyenhieu.name.vn\/wp-content\/uploads\/2023\/11\/image-2.png\" alt=\"\" class=\"wp-image-21\" srcset=\"https:\/\/nguyenhieu.name.vn\/wp-content\/uploads\/2023\/11\/image-2.png 402w, https:\/\/nguyenhieu.name.vn\/wp-content\/uploads\/2023\/11\/image-2-300x151.png 300w\" sizes=\"auto, (max-width: 402px) 100vw, 402px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Continue by running the following batch of commands.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>cd ..<br>tar -cf local.tgz etc\/<br>tar -cf state.tgz local.tgz<br>mv state.tgz \/boot<br>umount \/boot<br>reboot<\/code><\/pre>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>Tips: Boot back into the Gparted Live media. We will be repeating steps 4 except we will be editing the \/dev\/sda6 partition rather than \/dev\/sda5. The only difference in this process is to change the command to mount the correct partition.<\/p>\n<\/blockquote>\n\n\n\n<p>5. Remove the Gparted media and boot the ESXi host. Once the ESXi host has completed booting, log on as root from the DCUI console. You should be able to log in without typing in a password. Now you may reset a new password.<\/p>\n\n\n\n<p>This method is not supported by VMware, but it works on various versions of ESXi. When resetting VMware root password, the most important thing is to make a VMware backup before performing this operation.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h_6\">Summary<\/h2>\n\n\n\n<p>This article introduced how to reset\u00a0VMware ESXi\u00a0root\u00a0password without reinstalling ESXi host, which saves a lot of time. When you are resetting ESXi root password, if your virtual machines do not have downtime, you should migrate your virtual machines, as well as\u00a0backup VMware ESXi VMs.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>There is no default root password in VMware ESXi, so when you log in ESXi, you are required to enter your IP address, root name and password first. You&#8217;d better write down your root password to cope with the following scenarios: If you forget your password and don&#8217;t want to reinstall your ESXi hosts, what [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":73,"comment_status":"closed","ping_status":"open","sticky":false,"template":"single-with-sidebar","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[7,10],"class_list":["post-18","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-visualization","tag-esxi","tag-reset"],"_links":{"self":[{"href":"https:\/\/nguyenhieu.name.vn\/index.php?rest_route=\/wp\/v2\/posts\/18","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nguyenhieu.name.vn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nguyenhieu.name.vn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nguyenhieu.name.vn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nguyenhieu.name.vn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=18"}],"version-history":[{"count":1,"href":"https:\/\/nguyenhieu.name.vn\/index.php?rest_route=\/wp\/v2\/posts\/18\/revisions"}],"predecessor-version":[{"id":22,"href":"https:\/\/nguyenhieu.name.vn\/index.php?rest_route=\/wp\/v2\/posts\/18\/revisions\/22"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/nguyenhieu.name.vn\/index.php?rest_route=\/wp\/v2\/media\/73"}],"wp:attachment":[{"href":"https:\/\/nguyenhieu.name.vn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=18"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nguyenhieu.name.vn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=18"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nguyenhieu.name.vn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=18"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}