How to Hack Root Password in Linux

By Angsuman Chakraborty, Gaea News Network
Monday, November 3, 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

  1. The first step is to reboot server.
  2. Upon Linux booting up to GRUB loader GUI, move the arrow key up/down to highlight and select the Linux kernel and press e to edit the GRUB commands before booting.
  3. Next, move the arrow key up/down and select the Linux kernel and press e again
  4. Give a single space and then type the word single at the end of edited line, as shown in this snapshot
  5. Press the ENTER key and now you have a a similar GRUB screenshot as of follow.Keep the Linux kernel highlighted and press b to 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)
  6. Once the Linux boot up completely into single user maintenance mode, the Linux command prompt is ready to execute command. Type passwd to 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.
  7. Type reboot or exit to 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

  1. First reboot the server
  2. When you see the LILO: prompt type linux single and hit enter.
  3. This will log you in as root in single user mode.
  4. Once booting is complete, you can change your password with this passwd followed by the new password you want to assign
  5. 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.

Discussion
July 20, 2010: 11:36 pm

I would also like to know how can be create a single page with payment system in an estore.. where the shipping information and payment info can be made on single page


dE
July 11, 2010: 11:47 am

Thanks for telling me this security venerability. Now I’ll ensure the grub menu never comes up.


sanjay
March 5, 2010: 5:07 am

how can i get my password back of linux as i have forgot it

January 24, 2010: 9:40 pm

If you need a video for this example it is available at


Tumar baba
January 22, 2010: 5:18 am

U are giving some false info in this site. So plz stop fooling others and save their time from surfing ur website. dont take it personally.


rickastley
December 19, 2009: 12:28 am

Naveen brb,…. hacking your box

December 3, 2009: 5:11 am

Hai this is naveen from intellectindia. I was installed Fedora 8 to my System and i give the password as kavitha.but when i try to logon root cannot taken the password.please help me.


Dave
September 28, 2009: 8:26 am

How do we password protect grub? That is WAY to easy


Darin Peterson
July 7, 2009: 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

April 28, 2009: 5:20 pm

my root was not login & i am trying to give passwd to my root but it didn’t work help me

March 16, 2009: 10:25 am

Install pidgin.


arian
March 16, 2009: 8:19 am

hi!!!!!!!
I don’t have any massenger for chat please show me one way for
have a massenger


Avishek
February 26, 2009: 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.

November 7, 2008: 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

November 5, 2008: 4:40 pm

hi soumya,

can you post pics for ubuntu, say 8.10 as well ?

thank you,

BR,
~A

YOUR VIEW POINT
NAME : (REQUIRED)
MAIL : (REQUIRED)
will not be displayed
WEBSITE : (OPTIONAL)
YOUR
COMMENT :