This will work for all users although if you know the root password you can reset the user password anyway.

So I was going to use my old PC as a client for my Windows Domain Admin class but first I needed to make sure that I didn't have any files that were important, unlikely since I hadn't used the computer in years, but still need to check.

So I booted up the old PC and realised I couldn't remember the passwords, oops!! After googling for the answer I found this way to reset (really delete) the root password, well any user password since they are all in the same file. BTW this computer is running Slackware Linux 12.2 (probably my favourite Slackware release)

Get a bootable distro that you can copy to disk and boot into a live environment or use one of the many rescue disks out there, I used systemrescueCD which is really nice and easy to use and is quite easy on resources, the PC only has 640Mb of memory, so the newer Ubuntu live CD doesn't run very fast or smooth.

Boot up the CD select an option, there are quite a few, I had to try a couple before I got one that worked, seems that there was a problem booting into a graphical environment, something wrong with the monitor settings (out of sync or refresh error, I forget which) but that doesn't matter since I am happy using the command line. So once booted and at the prompt you need to mount the hard disk (remember this is running off the disk/RAM);

mount -t auto /dev/sda1 /mnt

Then go to the /etc directory

cd /mnt/temp/etc/

Edit the shadow file that holds the password information using your favourite editor such as emacs, vi, pico etc, my editor of choice is emacs

emacs shadow

then what you need to do is locate the line that starts with root, usually the first line, and remove the encrypted password. This is the random assortment of letters between the second and third colons (:), highlighted in red below and just delete it


to leave


Save the file and that's it, just reboot, remembering to remove the CD and when you get to the login screen* just enter root as username and leave the password field empty and BOOM!! access is granted.(see below)

Last thing...remember to set a new root password.

* I couldn't login through the GUI after I had done this I had to reboot using the liveCD and change the runlevel in the inittab file then reboot to the text login and all was well, gave myself a new password and changed the runlevel back to the GUI and rebooted and was able to login as needed.