General discussion


forgot linux root password

By lavi0007 ·
i forgot my linux root there any way to recover it.....or i'll have to re-install the o.s...???

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -

by BFilmFan In reply to forgot linux root passwor ...

You aren't the only person that has had that pleasure. Lots of help here:

Collapse -

by vdanen In reply to forgot linux root passwor ...

This is very easy to do. Reboot or start your computer with the
install CD or a downloadable Live CD. If the CD has it, boot into
rescue mode (ie. Mandrakelinux CDs let you boot into rescue
mode). You should then be able to mount your partitions,
although you really only need to mount your / partition. For
instance, if /dev/hda2 was your / partition, you might mount it
as /tmp/cdrom or /mnt/cdrom or something by doing "mount /
dev/hda2 /tmp/cdrom"; depending on the distro you may need
to pass the fs type to mount (ie. "mount -t reiserfs /dev/hda2 /
tmp/cdrom"). Anyways, once this is done type "chroot /tmp/
cdrom" and then you'll be chrooted (or jailed, locked into) your /
filesystem. Make sure you're doing this as the root user! Once
you've done that, you can just type "passwd [user]" or "passwd"
(to change root's pw) and reset your password.

Collapse -

by jopoy In reply to forgot linux root passwor ...

What boot loader are you using?

If you are using LILO:
At the boot loader options type "linux single"

If you are using GRUB:
observe the kernel parameters, just change the init option at the end of the boot options/parameters to 1. (It's been a long time since I rebooted so please bear with me)

This will boot you to single user mode. You will then be able to user "passwd" to change your password. If all else fails, try searching google with the string "how to boot linux in single user mode"


Collapse -

by henrymercedes In reply to forgot linux root passwor ...

you have to reboot your pc with lilo and after that type linux single, to enter in single user mode the in the prompt type use passwd to change the password and then reboot

Collapse -

by mullapudi3 In reply to forgot linux root passwor ...

1)While booting at botrecord press e to edit
2)u can see the kernel-hd0
by moving the arrows highlight that and then press enter
3)now press space bar once at type single then press enter
4)press b to boot
5)you will get sh#
6)type passwd root
type new password
retype password
7)type reboot to boot again

Collapse -

by alokchauhan1 In reply to forgot linux root passwor ...

yes u can break it if it is grub loader then on boot option screen press " e " key of keybord to edit the boot loader setting n go to the second line of boot loader then again press " e " key n give a gap after all words and type " 1 " for single and press Enter key then press " b " key to boot into modified loader. now it will boot the system in single user mode or root without prompting any user or password then u can changer the password by " passwd " command for root. same procedure u can follow for LILO boot loader but to edit u have to press Ctrl+C first and then u can edit it by the same procedure. i hope this will work for u. best of luck

Collapse -

by ben In reply to forgot linux root passwor ...

I had a similar experince and the posts on this page were helpful in resolving my problem. So thanks to all those that posted. I'm using Mandrake 10.1, and noticed that while changing my password allows me to logon as root while using specific configuration tools, when I try to anything as root (SUDO) via CLI I'm told that my password is invalid. Did I miss something?

Collapse -

by csturman In reply to forgot linux root passwor ...

Not to be a pain but this question gets asked in the forums of JustLinux.Com a lot by wannabe hackers.....

Collapse -

by jdclyde In reply to forgot linux root passwor ...

I will assume you have physical access, as this can't be done remotely and if you don't have access you have no business getting on.

How do I reset the root password if I forget it? (part 1)

This procedure will work for Xenix, and for Unix as well if you are using a very relaxed security level (one which stores encrypted passwords directly in /etc/passwd). If you're using a higher security level on Unix, look for part 2 below.

For Linux, see

For Unixware 2.12, adds some useful info.

Boot the system from your emergency boot diskettes (if you didn't make these and keep them up to date, shame on you, but you should be able to use N1/N2 instead, and see the entry on crashing out of these diskettes below). Next,

mount /dev/hd0root /mnt

; this will mount your hard drive's root filesystem on /mnt.

On some v5.0.x systems, /dev/hd0root won't exist. Create it with

mknod /dev/hd0root b 1 42

See also

Edit /mnt/etc/passwd. The first line will be your root line, such as

Edit out the encrypted password (don't touch anything else!) so that the line reads something like

Save the file and shut down. Reboot from the hard drive. Your root password has now been removed, and you can reset it normally.

Collapse -

by kannan.santhosh In reply to forgot linux root passwor ...

First login to single mode user to do that:
press e for edit .
then type sigle at end of the line and press b to boot.
After that it will boot in single mode type passwd.It will ask for a new root passwrd .Then type init6 to restart.

Related Discussions

Related Forums