Monday, October 22, 2012

passwd: Authentication token manipulation error

There are times when you will entirely left out a box in the dark and then one day it suddenly becomes the jagging hinge pulling out all the steam to a project you have or to a legacy system that has recoiled from it since its very inception.  What do you do when you can no longer retrieve your password?

In this post I am going to lay down simple steps to allow you to retrieve passwords from both virtual systems (vmachines) and physical ones.

  1. LiveCD -- it is best that you have a liveCD kept somewhere for emergency.  This CD either in physical media and/or ISO image will go along way.
  2. A good procedure to work on. 

Procedure:
----------------------------------------

  1. If it is a physical box, configure your BIOS to boot to your CD/DVD-ROM drive.  If it is a virtual machine, you will have to configure it to boot from an ISO image somewhere in you system. 
  2. Do this as root.  Identify the partition which needs to be accessed via "chroot".
  3. Create a staging directory for the system you intend to recover.
  4. Mount that system using this command:    e.g. mount -rw -t ext4 /dev/sda4 /mnt/
  5. chroot /mnt/  -- this would drop you to the chrooted environment of the system you intend to recover.
  6. Issue the command:   "pwconv"  (The "pwconv" command creates shadow from passwd and an optionally existing shadow)
Thats it, issue fixed.

Cheers!!!