Boot Ubuntu from single more, from grub menu choose (recovery mode)
Once the system has booted, you can change the root password using the password command:
Code:
passwd
If you had unable recovery mode boot menu because of security reason, there is another option. Boot Ubuntu CD. After booting up from the Ubuntu CD, go to a terminal and sudo to root (no password is required). After your priviledges have been escalated, issue the following commands (be sure to replace each /hda1 with your own root ('/') partition):
Code:
mount -o dev,rw /mnt/hda1 cd /mnt/hda1/etc
Once you are into your system /etc directory, you can use a text-editor (such as vim, nano, pico, etc.) to edit the /etc/shadow file where the password is stored. Various information about root and user accounts is kept in this plain-text file, but we are only concerned with the password portion.
For example, the /etc/shadow entry for the "root" account may look something like this:
Code:
root:$1$aB7mx0Licb$CTbs2RQrfPHkz5Vna0.fnz8H68tB.:/
10852:0:99999:7:::
(The '/' indicates a line continuation)
Now, using your favorite editor (I'll use vim) delete the password hash (the green text).
Code:
vim shadow
After you've edited this field, it should look like this:
Code:
root::10852:0:99999:7:::
Now save the file and change back to the root directory and unmount the system root partition (don't forget to change the /hda1) as follows:
Code:
cd / umount /mnt/hda1
Now reboot the computer.
Once the computer has booted and you're at the login prompt, type "root" and when asked for the password just press ENTER (entering no password). After a successful login, you need to set the new password for root using the following command:
Code:
passwd
0 comments:
Post a Comment