Server Administration & Management

How to reset root password in Debian Linux

1. At grub-boot loader screen. Select Recovery mode the version of the kernel that you wish to boot and type e for edit. Select the line that starts with kernel and type e to edit the line.

2. Go to the end of the line and type init=/bin/bash as a separate one word (press the spacebar and then type init=/bin/bash). Press enter key to exit edit mode.

3. Back at the GRUB screen, type b to boot into single user mode. This causes the system to boot the kernel and run /bin/bash instead of its standard init. This will allow us gain root privileges without password.

4. If you wanna reset root password remount partitions

# mount -n -o remount,rw /

# mount -avt nonfs,noproc,nosmbfs

# cd /etc

# passwd

Changing password for user root.
New UNIX password:
Retype new UNIX password:

5. Now, you will get following messages. It means that password for root user has been updated.

passwd: all authentication tokens updated successfully.

6. At last, reboot the server and you are done.

November 25, 2011 Posted by | Tips & Tricks, Unix/Linux | , , | Leave a comment