Knowledgebase
Knowledgebase
Change Root Password Debian, Ubuntu and CentOS 7 (Single User mode)
Posted by Will Kruss on 07 February 2017 09:53 AM

If you have forgotten your root password to any of the above operating systems, you will need to boot into single user mode and reset the root password.

To do this you need to access the web based console through the portal, see: https://www.vpsblocks.com.au/support/Knowledgebase/Article/View/28/0/how-can-i-get-console-access-to-my-vps

Once you have access, reboot the machine and when you see the Grub loader, select the 'Recovery Mode' option from the list

Once selected press: e

Look for the line starting with linux (it contains the paths to VolGroup00)

After that word enter a space then type:  init=/bin/bash

Press F10 ot CTRL-X to begin booting

This will boot directly to bash without requiring you to enter a password.

To mount the local disk type: mount -rw -o remount /

To change the root password then type: passwd root

Set the new password

Enter the command: touch /.autorelabel

Then restart the VPS (you will need to send ctrl-alt-del or hard boot it in the VPS Management section in the portal to restart the VPS - typing reboot will not work).

Once the VPS restarts you should be able to access using the newly configured root password.

(0 vote(s))
Helpful
Not helpful