Today we are going to take a look at changing the root password on a Linux system. For the purpose of this tutorial I have used Linux Mint 11. Insert a live CD and allow it to boot. When you come to the desktop open up a terminal and type:
sudo fdisk -l
This will list all the partitions used on the system. Find the one which houses your linux installation and make a note of it (e.g sda1). Next we need to make a directory on the desktop and mount our linux installation. We do this by typing:
sudo mkdir realroot
sudo mount /dev/sda1 realroot
Our linux installation should now be visible on the desktop. We now need to navigate to the /etc/shadow file on the linux distribution. Once there type:
sudo gedit /etc/shadow to open it up with gedit.
Locate the line which starts with root and delete the encrypted password leaving it empty. Save the file and restart the system. You should now be able to switch to root without using a password. However this presents a huge security risk. So as root type:
passwd
You will be asked to state a new root password and then to confirm it. Once done make a note of your new password!!
About the Author
Hi I am Chris the owner of ComTech. I provide IT Support and Computer repairs to both personal and business clients in and around Stirling. For a list of what I can offer you why not visit my website www.comtech247.net where you will find my blog, testimonials, services and much more. Start supporting a local business today so I can start supporting you.
If you found this blog useful then why not sign up to my RSS Feed for news, tutorials, views and general techie stuff!!
Another cool way to do this (if you use grub):
In grub, edit the boot options to add
rw init=/bin/bash
It will start you out in a root shell (but you’ll probably have
to reboot to do a normal startup afterward.)
Then, just issue a passwd command and give root a new password.
These boot options only last for one boot and then things go back to normal.