Vote
5
How to Hack Root Password in Linux
Angsuman Chakraborty
November 3rd, 2008
Today I am going to tell you the trick to hack your root passoword in Linux if you are too forgetful to remember it or you have legal permission to enter a server run by a different admin and by any chance he forgot to give you the root password.
Those Who Have GRUB bootloader
- The first step is to reboot server.

- Upon Linux booting up to GRUB loader GUI, move the arrow key up/down to highlight and select the Linux kernel and press
eto edit the GRUB commands before booting.
- Next, move the arrow key up/down and select the Linux kernel and press
eagain - Give a single space and then type the word
singleat the end of edited line, as shown in this snapshot
- Press the ENTER key and now you have a a similar GRUB screenshot as of follow.Keep the Linux kernel highlighted and press
bto boot up with the single keyword, which will boot Linux into single user maintenance mode (You did nothing but to grant yourself the booting facility of a single user that is otherwise not visible while you enter the server as a root in a proper way)
- Once the Linux boot up completely into single user maintenance mode, the Linux command prompt is ready to execute command. Type
passwdto reset the forgotten root password - without prompting for old root password, just type a new root password and re-type to confirm it and you are done. You have successfully changed or reset the old password without having known the old one.
- Type
rebootorexitto reboot. On next boot up, you can login with the new root password!
Remember, it is for those who have GRUB bootloaders.
Those who have LILO boot loader
- First reboot the server
- When you see the LILO: prompt type linux single and hit enter.
- This will log you in as root in single user mode.
- Once booting is complete, you can change your password with this passwd followed by the new password you want to assign
- You are done.
P.S. - Admins, take a note and use passwords to secure LILO and GRUB so that no one gets access to boot loaders' commands. I will surely come with a tutorial on that too.
Filed under Fedora 7, Fedora Core 6, How To, Linux | Tags: Grub, Hack root password, LILO, Maintenance, The root |
8 Comments |
Email this Article





November 5th, 2008 at 4:40 pm
hi soumya,
can you post pics for ubuntu, say 8.10 as well ?
thank you,
BR,
~A
November 7th, 2008 at 7:46 am
@ anjan
I am currently using Fedora. I feel the same should apply for Ubuntu as well.Here is a slightly different process
Press e for edit.
Highlight the line that begins kernel ………, press e
Go to the very end of the line, add rw init=/bin/bash
press enter, then press b to boot your system.
Your system will boot up to a passwordless root shell.
Type in passwd username
Set your password.
Type in reboot
[p.s. -> adding init=/bin/bash to your kernel line takes you straight to a bash prompt from bootup. You'll probably have to remount your '/' partition as rw, and remember to sync after making any changes. You won't be able to shut down nicely from this state, so ctrl + alt + del is the only option.]
Tell me if that worked.
Regards
Soumya
February 26th, 2009 at 12:57 pm
What should I do if the computer does not show the “e” option. The only difference is that this computer has two kernels… and none of them gives the edit option–all I am allowed to do is selection using up and down arrow key or type “p” for further tasks.
March 16th, 2009 at 8:19 am
hi!!!!!!!
I don’t have any massenger for chat please show me one way for
have a massenger
March 16th, 2009 at 10:25 am
Install pidgin.
April 28th, 2009 at 5:20 pm
my root was not login & i am trying to give passwd to my root but it didn’t work help me
July 7th, 2009 at 1:01 am
You saved my butt on that one. I’m not one to forget passwords, or to mess up when typing them, but just so happened that I updated my Linux PCs passwords and must have double fat fingered the root and user passwords…
I can’t thank you enough!
Darin
September 28th, 2009 at 8:26 am
How do we password protect grub? That is WAY to easy