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.
  1. Boot the your machine and login to your live Linux image. 
  2. 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
  3. Mount your original Linux system's hard drive on a directory of your choice
    sudo mount /dev/sda1 /media/your_drive
  4. chroot your mounted drive
    sudo chroot /media/your_drive
  5. Change any username's password
    sudo passwd (i.e. for root) or sudo passwd anyusername


Popular posts from this blog

Testing SOAP services using pingdom