How to reset root password

In this article I will show you the fastest and easiest way to change your forgotten password on your linux machine. You will need physicall access to your computer and you must be using LILO or GRUB as your boot manager with no password protection. If you dont meet these conditions, following howto will not help you - in this case, try to visit great tutorial How to Reset forgotten Root passwords by Suramya Tomar on Linux Gazette website.

1) Reboot your computer and pause it on boot manager screen.

2a) If you are using LILO, press any arrow key to stay on lilo boot screen and type the following in the boot prompt of lilo manager: "name_of_your_boot_image init=/bin/bash" (for example "linux-kernel-2.6.3 init=/bin/bash").

2b) In case that you are using GRUP, you have to proceed with little more steps to do the same. First choose boot option with highlight and press "e" which will take you to another screen. Select here line starting with kernel and press "e" again. Now append " init=/bin/bash" to the line and hit Enter.

3) The system will boot in single user mode and you should be logged as root.

4) The filesystem is mounted in read only mode so you will need to remount it in read-write. To do it, type "mount -o remount,rw /" and hit enter.

5) Now we will change the password for root user - type "passwd" and then your new password (twice).

6) Reboot the machine in the normal way and you should be able to log as root with your new password.


Related posts