Linux: Reset root password
Posted: Thu Oct 09, 2008 10:00 pm
Sometimes you receive a computer from someone else, but they forgot to tell you login credentials.
Here's a short HowTo for resetting the root password to an empty string:
1) boot the computer - until GRUB comes up
2) In GRUB, press 'e' and add the following text to the boot parameters:
3) You should now boot into single-user runlevel, ending at a bash prompt as root.
4) Remount the harddisk read-write:
(For further details, look at [DETAILS] section below)
5) Edit /etc/shadow and the password hash for root with nothing. You will find something like this:
[DETAILS]
1) In case your system disk ain't /dev/hda1, type:
The beginning of the output shows you your device. it might look like this:
Here's a short HowTo for resetting the root password to an empty string:
1) boot the computer - until GRUB comes up
2) In GRUB, press 'e' and add the following text to the boot parameters:
Code: Select all
single init=/bin/bash
4) Remount the harddisk read-write:
Code: Select all
mount -o remount,rw /dev/hda1
5) Edit /etc/shadow and the password hash for root with nothing. You will find something like this:
make it look like this:root:$1$verylonghashwithlettersandnumbers0:99999:7:::
6) Save the file and reboot. Now you should be able to login as root with no password.root:0:99999:7:::
[DETAILS]
1) In case your system disk ain't /dev/hda1, type:
Code: Select all
mount | grep "on / type"
/dev/sda1 on / type ext3 (rw,noatime,errors=remount-ro,data=writeback)