1819966 Members
3412 Online
109607 Solutions
New Discussion юеВ

Re: Reset root password

 
Vinit Adya
Frequent Advisor

Reset root password

How to reset a "lost" root password for a linux system?
6 REPLIES 6
John Poff
Honored Contributor

Re: Reset root password

Hi,

Reboot the system into single user mode, where you will be able to change the passwd as root.
To get into single user mode, when you first boot the machine and get to the boot: prompt, type in 'linux single' and press Enter.

JP
Umapathy S
Honored Contributor

Re: Reset root password

If you are using redhat, reboot the system in single user mode (unless you haven't changed the /etc/inittab for ~~:S:wait:/sbin/sulogin)
change the password using password command.

Alternatively,
get a boot-disk/iso-cd itself and boot. mount the / in rw mode, edit the /etc/passwd and clear the passwd entry.

Hope this helps.

cheers
Umapathy
Arise Awake and Stop NOT till the goal is Reached!
Sergejs Svitnevs
Honored Contributor

Re: Reset root password

Reboot to single user mode ( http://www.redhat.com/docs/manuals/linux/RHL-7.3-Manual/custom-guide/s1-rescuemode-booting-single.html ). When you get to the prompt, do a
# passwd root
and
# /bin/shutdown -r now

For Debian Linux check out the following link:
http://rtfm.dyndns.info/tips/2000/04/07/11.shtml

Regards,
Sergejs
Jerome Henry
Honored Contributor

Re: Reset root password

But you'll be in trouble if you'r using GRUB with passwd authentication, then there is no easy way to pass this...
SAme probl with Lilo's protection on.
If the above tips do not work, let us know your Boot loader (lilo or grub) and distro...
You can lean only on what resists you...
Francisco J. Soler
Honored Contributor

Re: Reset root password

My method is to boot from the SysAdmin Survival CD from Red Hat, then i mount the disc in read write mode and edit the /etc/shadow or /etc/passwd, removing the root password.

Then i boot the system normaly and set a new password for root.

Frank.
Linux?. Yes, of course.
Leovino A. Trinidad, Jr
Frequent Advisor

Re: Reset root password

Hi! If you are trying to retrieve the existing password (for other reasons such as other application dependeny on the root account/password, I suggest you use the "linux single" command by issuing this during boot up -- press control-x when the graphics appear then type it in the "boot:" (for REDHAT). Then look for the "shadow" file and crack it. There a lots of linux password cracker in the net...one of which is john the ripper. It takes time to crack the password especially with long and special characters.

Hope this helps.