Changing the root password via rescue mode does not work

1.5k Views Asked by At

I have a Public Cloud instance via OVH. I reinstalled my computer without backing up my ssh-key. I also forgot the root password for the server. I do have access to my Public Cloud control panel and rebooted with rescue mode.

However, when I change my root password (via the noVNC console) and then reboot to my Ubuntu disk, the new password is incorrect. The passwd command returns: passwd: password updated successfully!. But then I can't login as root with the new password after exiting rescue mode.

What am I doing wrong?:

2

There are 2 best solutions below

0
On

When you are in rescue mode and you change the password with passwd, you change the password for the rescue mode only !

If you want to change you "normal OS" password from the rescue mode, you first need to chroot into the partition holding your "normal OS" and then use passwd there to change your password:

$ chroot /mnt/vdb1/
$ passwd

More details in the official doc

0
On

By default, password login for root and the default user is not possible by ssh. If you used a key, you'll need to replace that key via the Rescue Mode. You can follow that guide to do that : Replacing your lost ssh key pair

Also, remember that you need to mount your partition containing your OS before doing any modification. The step are well describe in the OVH documentation here : Put an instance in Rescue Mode