resetting the root password in linux

2

1

How do I reset the root password in fedora ? Is there any way out ? I have googled a lot but couldn't find any useful result.

Suhail Gupta

Posted 2012-08-01T06:21:23.383

Reputation: 1 655

Do you just want to reset the password or do you not have it to begin with? – MaQleod – 2012-08-01T06:24:29.950

@MaQleod reset the password – Suhail Gupta – 2012-08-01T06:27:12.940

Answers

8

the Fedora documentation gives Information on how to reset the root password.

You can also use this more general approach here with init=/bin/bash which works on about any distro.

This is from the Ubuntu documentation:

  1. Reboot your computer

  2. Press SHIFT or ESC at the grub prompt (as earlier).

  3. Select your image.

  4. Highlight the line that begins kernel and press 'e' to edit

  5. Go to the very end of the line, change the ro to rw and add init=/bin/bash

press enter, then press b to boot your system.

Your system will boot up to a passwordless root shell.

  1. Type in passwd username

  2. Set your password.

  3. Type in reboot

This should work,too

user118305

Posted 2012-08-01T06:21:23.383

Reputation:

2

With sudo access:

When you at least have sudo access to the machine you can use sudo bash to aquire a root shell and passwd afterwards.

With chroot:

Another way would be to boot from a LiveCD (or USB Stick with a live System). Then you have to mount your system partitions. At least the ones containing /etc and the location of passwd, probably /bin check with which passwd. Afterwards you chroot into that directory.

 mount /dev/sda1 /mnt/system
 mount /dev/sda2 /mnt/system/etc
 chroot /mnt/system /bin/bash

Now you are virtually inside your new environment and can use passwd. Maybe you have to update your environment with hash -r before.

Baarn

Posted 2012-08-01T06:21:23.383

Reputation: 6 096

1

This works in debian distros, should work in Fedora I think (assuming you have sudo privs)

sudo passwd root

type and verify the new password and done.

Keltari

Posted 2012-08-01T06:21:23.383

Reputation: 57 019