VMware Cloud Community
leots
Contributor
Contributor
Jump to solution

Reset root password from shell

Hi All,

An accident happen - I need urgent help!

Yesterday I changed root password of one of my ESXi hosts (ESXi 6 upd. 2).

I checked the new password and it was good.

Today I can't login with the new password, nor with the old one.

Say's something weird happened and I lost the password.

I still have root access to shell (based on SSH keypair).

I can change password in shell, but can't login with the new password, nor to shell, neither to ESXi client.

Is there a way to define root password from the shell?

Any help will be really appreciated.

Thank you in advance.

1 Solution

Accepted Solutions
mprazeres183
Enthusiast
Enthusiast
Jump to solution

Hi leots,

Unfortunatelly the only thing you will have to reinstall the ESXi, there are methods of doing it, but it's not really recommended.
And it could be a unsupported configuration.

However, did you try to reboot the ESXi host after you changed the PW?
And I would suggest you to do this:

Change the Passwort to something easy (However it should pass the complexity of the PW)

Then restart the management agents, you can access the DCUI from SSH by writting DCUI to the SSH Console.

Try to access it trough the SSH, if this works restart the management agents, if that dosn't work, restart the management agents by running this from the SSH Console:

/etc/init.d/hostd restart

/etc/init.d/vpxa restart

After this try again to connect the host to your vCenter or by accessing it trough the IP adress on the Browser.
If this time you can log-in then the problem is solved, if not reboot the host.


You need to ssh to the Host:

esxcli vm process list

this will give you a list of all vGuests running.

Then what you have to do is to power them off, you have 3 possibilities, soft, hard and force. Try soft by running it this way:

esxcli vm process kill --type= [soft,hard,force] --world-id= WorldNumber

(Just type Soft and the WorldNumber that you find when you run the esxcli vm process list of each running VM.

Now reboot the Host.
After the Host comes back, just try to reconnect using the PW you set before.

If that dosn't work, you may just re-install, you will not lose any data if you do it correctly, select only the drive where the OS is on and not where the data of the vGuests are.


Or then you can use the unsupported (But I do not recommend you to do it) set a new PW:

4sysops.com/archives/three-ways-to-reset-a-vmware-esxi-root-password

Check my blog, and if my answere resolved the issue, please provide a feedback. Marco Frias - VMware is my World www.vmtn.blog

View solution in original post

0 Kudos
5 Replies
mprazeres183
Enthusiast
Enthusiast
Jump to solution

Hi leots,

Unfortunatelly the only thing you will have to reinstall the ESXi, there are methods of doing it, but it's not really recommended.
And it could be a unsupported configuration.

However, did you try to reboot the ESXi host after you changed the PW?
And I would suggest you to do this:

Change the Passwort to something easy (However it should pass the complexity of the PW)

Then restart the management agents, you can access the DCUI from SSH by writting DCUI to the SSH Console.

Try to access it trough the SSH, if this works restart the management agents, if that dosn't work, restart the management agents by running this from the SSH Console:

/etc/init.d/hostd restart

/etc/init.d/vpxa restart

After this try again to connect the host to your vCenter or by accessing it trough the IP adress on the Browser.
If this time you can log-in then the problem is solved, if not reboot the host.


You need to ssh to the Host:

esxcli vm process list

this will give you a list of all vGuests running.

Then what you have to do is to power them off, you have 3 possibilities, soft, hard and force. Try soft by running it this way:

esxcli vm process kill --type= [soft,hard,force] --world-id= WorldNumber

(Just type Soft and the WorldNumber that you find when you run the esxcli vm process list of each running VM.

Now reboot the Host.
After the Host comes back, just try to reconnect using the PW you set before.

If that dosn't work, you may just re-install, you will not lose any data if you do it correctly, select only the drive where the OS is on and not where the data of the vGuests are.


Or then you can use the unsupported (But I do not recommend you to do it) set a new PW:

4sysops.com/archives/three-ways-to-reset-a-vmware-esxi-root-password

Check my blog, and if my answere resolved the issue, please provide a feedback. Marco Frias - VMware is my World www.vmtn.blog
0 Kudos
leots
Contributor
Contributor
Jump to solution

0 Kudos
mprazeres183
Enthusiast
Enthusiast
Jump to solution

Hi Leots again,

Try to set a PW with at least 8 Digits and Lower and Capital such as at least 1 number.

Then try it again. You maight be able to set a PW, the thing is that it may not be secure and you will not see it. Only when you try to access and it tells you: NO GOOD.

Best regards,
Marco

Check my blog, and if my answere resolved the issue, please provide a feedback. Marco Frias - VMware is my World www.vmtn.blog
0 Kudos
leots
Contributor
Contributor
Jump to solution

Hi Marco,

Thank you so much! You saved my life!

ESXi reboot solved the problem, after reboot it accepts password, defined in shell.

Still quite strange, but working.

Thanks again!

Leonid.

0 Kudos
mprazeres183
Enthusiast
Enthusiast
Jump to solution

Hi leots,
I had this experience myself. And I never understood why.

It makes no sense, you change the PW and it's not working till you reboot, however I'm happy that it worked out for you.

Best regards,
Marco

Check my blog, and if my answere resolved the issue, please provide a feedback. Marco Frias - VMware is my World www.vmtn.blog