After having to reset my Ubuntu box password, I decided to come up with this tutorial on how to reset linux password, in this case we will be taking two different methods…
1- start by booting your computer and press ESC at the Loading Grub message
2- press e to enter edit mode, as shown in the figure
3- select the second line and press e
4- next press space after “splash” and type rw init=/bin/bash and press enter
5- press b to reboot
6- Once the computer reboot, you will get the root shell, type passwd username, where username is the user you want to reset the password.
type the new password and reboot.
In this method we will be using Ubuntu live cd to reset the password of the Linux box.
1- Start by inserting the live cd and booting the computer
2- Next open the terminal window and type sudo fdisk -l to see the available partitions. In this case there are only two partition, the partition which we want to reset the password is /dev/sda1.
3- Type mount -l to see if ubuntu mounted the partition… as you can see the partition has not been mounted yet
4- Next make the mount point by typing sudo mkdir /mnt/linux
5- Now let’s mount the /dev/sda1 partition by typing sudo mount /dev/sda1 /mnt/linux
6- Next chroot into the /mnt/linux directory by typing sudo chroot /mnt/linux
7- Now you are at the root shell, just type passwd username where username is the user you want to change the password
8- Reboot the machine, and login using your new password