Linux: How to reset root's or any other user's password
I've tried this only on Ubuntu server but it should work on all Linux-based machines. But first you must fulfill the following requirements:
- Have physical access to the machine
- Can command the machine to boot from CD or USB
- Have a live Linux image on a CD or a USB stick. You can usually boot an installable image and choose to "Try" Linux and not install it.
- Boot the your machine and login to your live Linux image.
- Decide on which disk does your original Linux system reside one (i.e. the one you need to reset the root password for).
sudo fdisk -l
- Mount your original Linux system's hard drive on a directory of your choice
sudo mount /dev/sda1 /media/your_drive
- chroot your mounted drive
sudo chroot /media/your_drive
- Change any username's password
sudo passwd (i.e. for root) or sudo passwd anyusername