Friday, March 25, 2011

Linux Password Reset

Just had to break into a customer's machine again.

This time it was a linux server. The pivotal part of the puzzle that allowed me to be successful was that I had physical access to the server. --So, it is good advice to put your servers in a well ventilated locked area.

Anyway, I used a live disk instead of booting into 'single user' mode. Any one image or distro with vi and some way to get to the command line should work.

mkdir /mnt/diskpartition

sudo mount -t ext3 /dev/sda1 /mnt/diskpartition

sudo vi /mnt/diskpartition/etc/shadow


For any user with su privileges, get rid of the data between the first and second colons.


The result of your changes in /etc/shadow should look something like this:

privilegeduser::15057:0:99999:7:::

Please note privilegeduser is just a generic name I used that was pulled from my imagination. It is unlikely you will find privilegeduser in your password files.

Now the password of said privilegeduser is empty and consists of no character data. Just hit <enter> at the login prompt for that user.

Passwords used to be kept in /etc/password but not any more on most modern systems.

Followers