From Fedora Project Wiki

No edit summary
(Reformatting)
Line 1: Line 1:
Setting up root password is a mandatory part of a Fedora installation. If you forget your root password, there is a way to reset it. Note that if you have set a password for your boot loader refer the last section and if you want to reset the boot loader password, refer [https://fedoraproject.org/wiki/Reset_Bootloader_Password here]. If you have encrypted your hard disk as well during installation, it is more difficult to do so and this document doesn't cover that scenario.  
Setting up a root password is a mandatory part of a Fedora installation. If you forget your root password, there are procedures to reset it.
* If you have set a password for your boot loader, refer to [[#bootloader-protected | this section]].
* If you want to reset the boot loader password, refer to [https://fedoraproject.org/wiki/Reset_Bootloader_Password these instructions].
* If you encrypted your hard disk during installation, it is more difficult to do so and this document doesn't cover that scenario.
* If none of these scenarios apply to you, proceed to [[#Entering_Recovery_Mode | the next section]].


Fedora uses run levels to determine the services being run when you start your system. Run level 1 is used as a recovery mode. Booting Linux under runlevel 1 or single user mode will allow you to reset your root password and you will directly get a root prompt on bootup. It is very easy to reset the password after that.  
Fedora uses ''run levels'' to determine the services being run when you start your system. Run level 1 can be used as a recovery mode. Booting Linux under run level 1, which is also called ''single user mode'', will display a root prompt on bootup, from which you can reset the root password.


== Entering Recovering Mode ==
== Entering Recovery Mode ==


While you system is starting up, press escape to see the bootloader called GRUB. After you see the menu,
While you system is starting up, hold down the ''Ctrl'' key or ''Esc'' to see the boot loader menu. After you see the menu:
* Use the arrows to select the boot entry you want to modify.
* Press ''e'' to edit the entry.
* Use the arrows to go to kernel line.
* Press ''a'' or ''e'' to append this entry.
* At the end of the line add the word ''single'' or the number ''1''.
* Press ''Enter'' to accept the changes.
* Press ''b'' to boot this kernel.


    * use the arrows to select the boot entry you want to modify.
A series of text messages scrolls by and after a short time, a root prompt appears awaiting your commands (#).
    * press e to edit the entry
    * use the arrows to go to kernel line
    * press a or e to append this entry
    * at the end of the line add the word single (or number 1)
    * press ESC to go back to the parent menu
    * press b to boot this kernel
 
You will see a series of text messages scroll by and you will get a root prompt with the text shell prompting for your commands(#).


== Changing root password ==
== Changing root password ==


As root, changing password does not ask for your old password. Run the command:
As root, changing password does not ask for your old password. Run the command:
 
<pre># passwd</pre>
<pre>
 
# passwd
 
</pre>


Enter your new root password twice. Congratulations! You now have now reset your root password. You can type reboot and press enter to restart your system.
Enter your new root password twice. Congratulations! You now have now reset your root password. You can type reboot and press enter to restart your system.


{{Anchor|bootloader-protected}}
== Reset Password When Boot Loader is Password Protected ==
== Reset Password When Boot Loader is Password Protected ==


Boot from the install or rescue CD/DVD
<ol>
 
<li>Boot from the install or rescue CD/DVD.</li>
Select "Rescue installed system"
<li>Select "Rescue installed system."</li>
 
<li>Answer the prompts for language and keyboard. Starting the network is optional and not needed.</li>
Answer the prompts for language and keyboard.
<li>Let the rescue mode mount your file systems in the read/write mode.</li>
 
<li>Hit ''Enter'' to get the shell prompt.</li>
Starting the network is optional and not needed.
<li>At the prompt, enter the following commands.  Do not enter any ''#'' mark or the text following it.  These comments are shown for explanatory purposes only.
 
<pre>chroot /mnt/sysimage   # Change to your disk file system
Let the rescue mode mount your file systems in the r/w mode.
passwd                # Change the root password
 
exit                  # Exit the chroot environment
Hit enter to get the shell prompt.
exit                  # Exit the rescue mode</pre></li>
 
</ol>
<pre>
 
# chroot /mnt/sysimage (Change to your disk file system.)
# passwd              (Change the root password.)
# exit                (Exit the chroot environment.)
# exit                (Exit the rescue mode.)
 
</pre>


The system will now unmount the file systems and reboot.
The system now unmounts the file systems and reboots.

Revision as of 12:47, 31 March 2009

Setting up a root password is a mandatory part of a Fedora installation. If you forget your root password, there are procedures to reset it.

  • If you have set a password for your boot loader, refer to this section.
  • If you want to reset the boot loader password, refer to these instructions.
  • If you encrypted your hard disk during installation, it is more difficult to do so and this document doesn't cover that scenario.
  • If none of these scenarios apply to you, proceed to the next section.

Fedora uses run levels to determine the services being run when you start your system. Run level 1 can be used as a recovery mode. Booting Linux under run level 1, which is also called single user mode, will display a root prompt on bootup, from which you can reset the root password.

Entering Recovery Mode

While you system is starting up, hold down the Ctrl key or Esc to see the boot loader menu. After you see the menu:

  • Use the arrows to select the boot entry you want to modify.
  • Press e to edit the entry.
  • Use the arrows to go to kernel line.
  • Press a or e to append this entry.
  • At the end of the line add the word single or the number 1.
  • Press Enter to accept the changes.
  • Press b to boot this kernel.

A series of text messages scrolls by and after a short time, a root prompt appears awaiting your commands (#).

Changing root password

As root, changing password does not ask for your old password. Run the command:

# passwd

Enter your new root password twice. Congratulations! You now have now reset your root password. You can type reboot and press enter to restart your system.

Reset Password When Boot Loader is Password Protected

  1. Boot from the install or rescue CD/DVD.
  2. Select "Rescue installed system."
  3. Answer the prompts for language and keyboard. Starting the network is optional and not needed.
  4. Let the rescue mode mount your file systems in the read/write mode.
  5. Hit Enter to get the shell prompt.
  6. At the prompt, enter the following commands. Do not enter any # mark or the text following it. These comments are shown for explanatory purposes only.
    chroot /mnt/sysimage   # Change to your disk file system
    passwd                 # Change the root password
    exit                   # Exit the chroot environment
    exit                   # Exit the rescue mode

The system now unmounts the file systems and reboots.