Mar 19, 2015

How to reset the root password on Ubuntu using a Live DVD

Yesterday I talked about how to mount an lvm2 volume in Ubuntu using a live DVD. In that post I talked about needing to do that to reset a root password for a server that I hadn't logged into in a while. In this post, I'm going to tell you how to reset that root password!

If you just do standard partitioning, this is pretty easy. Just mount the root partition of your systems hard disk (You can find it by running fdisk -l). Let's say your root partition is in /dev/sda1. Then you would run:
#sudo mount /dev/sda1 /mnt
If your root partition is in an lvm2 container, follow my instructions from yesterday.

Once you have your root partition mounted, then you need to chroot into that partition:
#sudo chroot /mnt
If you get a bash error, then that means you are mounting your system with a live DVD that doesn't match the architecture. For instance, if your system is running the 32 bit version of Ubuntu, you need to mount the root partition with a 32 bit Ubuntu live desktop DVD. The same goes with 64 bit.

If you didn't get an error, you should now be root on your system. Just run passwd now to set the new root password.

You can also do this to reset another user's password. For that just run passwd username.

Twitter Delicious Facebook Digg Stumbleupon Favorites More

Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | stopping spam