Debian Admin

Debian/Ubuntu Linux System Administration Tutorials,Howtos,Tips

  • RSS Subscribe

    subscribe to the Debian Admin RSS feed
  • Sponsors



  • Categories

  • Sponsors

  • Support DebianAdmin

    Amount $:
    Website(Optional):


  • Meta

  • Archives



how to change root password in debian

Posted by hey on October 13th, 2008

If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!

This is one of the problem faced by many person’s“what if i lost the root password”First thing that comes in mind is “use single user mode” but the answer is NO.
coz debian takes the system security to one more level up and by default ask’s for the root password.

so the BIG QUESTION IS HOW TO proceed further

follow these steps

1) on grub-boot prompt.
press “e” to enter edit mode

2) then press downarrow to reach the line that starts with “kernel “
press “e” again

3) at the end of this line type in “init=/bin/sh” or “/bin/bash”

4) then press enter to make that change and press “b” to boot

in a few seconds you will be on your “#” prompt

5) only one step left
“mount -o remount rw /”

this step is necessary coz in this case root file system is mounted as read only.

6) finally type “passwd” and you get the screen to change the password

and then type in “init 6? or “reboot”

NOTE FOR TECHNICAL USERS
those who are looking for the technical details, the main work is the init command that we passed as an argument to kernel, it told kernel to specifically run the command specified in parameter instead of working on normal routine.

TRICK = if you have any program you wish to run instead of this then you can do that too using init command only.

Source

Share/Save/Bookmark

5 Responses to “how to change root password in debian”

  1. Sachin Says:

    As long as you ‘ve physical access to the Linux box, you can crack in to any Linux box irrespective of which flavor of Linux use. So i don’t really believe with you - Debian is special and you can’t easily crack in to it.

  2. Dino Says:

    I have found that the best way to change a root password on a NIX box is to:

    - boot up with a “Live CD” such as KNOPPIX
    - mount (rw) the partition that contains the /etc folder
    - open the passwd file in a text editor of your choice
    - find the line for the root user
    - backspace over the field containing the encrypted password
    - save the file
    - remove the CD and reboot

    Now you can login as root without a password ans run passwd to reset it.
    KNOPPIX has many valuable uses. Get yours today at http://www.knoppix.net/

  3. mgh Says:

    - backspace over the field containing the encrypted password

    I do not see a password. I see
    and see no user names at all.

    How can I change?

    Installed Debian and con not log in as user or root, so do not no how to use passwd command, as I can not get to root terminal.

    Thanks.

  4. rjc Says:

    The file in question is “/etc/shadow” unless you explicitly disabled shadow passwords during installation.

  5. l33tmyst Says:

    What about if it’s a VPS (accessed by SSH?)

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>