From a62094bc2abb5c4db2924054f816258080d6cce8 Mon Sep 17 00:00:00 2001 From: Shaun Assam Date: Apr 13 2018 12:15:49 +0000 Subject: Revised and formatted reset-root-password for asciidoc --- diff --git a/_topic_map.yml b/_topic_map.yml index 6d7ed74..03c74eb 100644 --- a/_topic_map.yml +++ b/_topic_map.yml @@ -113,8 +113,8 @@ Topics: # File: postgresql # - Name: (FIX ME!) Raspberry Pi # File: raspberry-pi -# - Name: (FIX ME!) How to reset a root password -# File: reset-root-password +- Name: How to reset a root password + File: reset-root-password # - Name: (FIX ME!) Using UEFI with QEMU # File: uefi-with-qemu # - Name: (FIX ME!) Upgrading Fedora using package manager diff --git a/en-US/reset-root-password.adoc b/en-US/reset-root-password.adoc old mode 100644 new mode 100755 index 7a048b6..9dfbdf5 --- a/en-US/reset-root-password.adoc +++ b/en-US/reset-root-password.adoc @@ -1,154 +1,200 @@ -= How to reset a root password +[[chap-how-to-reset-a-root-password]] += How to Reset the root Password -''' +Setting up a root password is one of the steps when installing Fedora. +If you forget, or lose, the root password, there are two common methods to reset it: -[IMPORTANT] -====== +* In Rescue Mode -This page was automatically converted from https://fedoraproject.org/wiki/How_to_reset_a_root_password +* Using a Fedora Live Media (USB/DVD/CD) -It is probably -* Badly formatted -* Missing graphics and tables that do not convert well from mediawiki -* Out-of-date -* In need of other love +[[sect-how-to-reset-the-password-from-emergency-or-single-user-mode]] +== How to reset the root password in Rescue Mode +[NOTE] -Pull requests accepted at https://pagure.io/fedora-docs/quick-docs +==== -Once you've fixed this page, remove this notice, and update -`_topic_map.yml`. +Changing passwords as root does not prompt for the old password. -Once the document is live, go to the original wiki page and replace its text -with the following macro: +==== -.... -{{#fedoradocs: https://docs.fedoraproject.org/whatever-the-of-this-new-page}} -.... +While booting the system the link:++grub2.html++[GRUB2] menu will be displayed. +To boot the system into rescue mode using `bash` follow these steps: -====== +. Use the arrow keys to select the boot entry you want to edit -''' +. Press *e* to edit that entry +. Use the arrow keys to go to the line that starts with `linux`, `linux16`, or `linuxefi` -Setting up a root password is a mandatory part of a Fedora installation. -If you forget or otherwise lose your root password, there are procedures -to reset it. +. Go the the end of that line, add a space then type `rw init=/bin/bash`. +If your disk is encrypted, you may need to add `plymouth.enable=0` -* If you have set a password for your boot loader, refer to -link:#using-installation-cd-dvd[ this section]. -* If you want to reset the boot loader password, refer to -link:Reset_Bootloader_Password[ these instructions]. -* If none of these scenarios apply to you, proceed to -link:#Entering_Rescue_Mode[ the next section]. +. Press *Ctrl-x* or *F10* to boot that entry -Fedora uses _targets_ to determine the services being run when you start -your system. Run level 1 can be used as a rescue 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. +. Run the command: ++ +[source,bash] -[[entering-rescue-mode]] -Entering Rescue Mode -~~~~~~~~~~~~~~~~~~~~ +---- -[[using-grub2]] -Using GRUB2 -^^^^^^^^^^^ +passwd -While booting the system the GRUB2 menu will be displayed, to boot the -system using bash follow these steps: +---- ++ +It will prompt you to enter the new root password twice. -* Use the arrow keys to select the boot entry you want to edit -* Press *e* to start editing that entry -* Use the arrow keys to go to the line that starts with *linux* or -*linux16* -** If you have a UEFI system it's the line that starts with *linuxefi* -* Go the the end of that line add a space then *rw* then another space -and *init=/bin/bash* -** If your disk is encrypted, you may need to add *plymouth.enable=0* as -well -* Press *Ctrl-x* or *F10* to boot that entry +. Restore the SELinux context and permissions with: ++ +[source,bash] -[[changing-root-password]] -Changing root password -~~~~~~~~~~~~~~~~~~~~~~ +---- -As root, changing password does not ask for your old password. Run the -command: +touch /.autorelabel -.... -# passwd -.... +---- -Enter your new root password twice. Congratulations! You now have now -reset your root password. ++ -To make sure that selinux context of file which were now modified is -restored properly after reboot, run: +[WARNING] -.... -# touch /.autorelabel -.... +==== -You can than reboot the machine with +If you do not restore the SELinux permissions, the boot process may fail. +You may have to do a hard-reboot and start back at step 1. -.... -# /sbin/reboot -f -.... +==== -[[reset-password-using-a-fedora-cddvd]] -Reset Password Using a Fedora CD/DVD -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +. Reboot the machine with: ++ +[source,bash] -[[using-any-of-the-fedora-live-media]] -Using any of the Fedora Live Media -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +---- -* Boot the Live installation media -* After it finishes booting and starts the live session, open a terminal -and switch to root (using `su`, it won't ask for a password) -* Create a directory where you can mount the filesystem of your -installation: +/sbin/reboot -f -`mkdir /mnt/sysimage` +---- -* Mount the filesystem of your installation (/dev/sda1 is just an -example, be sure to fill in the actual device node of your installation -root */* partition): +The system may take a while to boot as SELinux will be relabeling its permissions on the filesystem. +If you see the Plymouth boot screen you can press the `ESC` key on your keyboard to view the SELinux progress. +Once it is complete, your system is ready and your root password has been successfully changed. -`mount /dev/sda1 /mnt/sysimage` +[[sect-reset-password-using-the-fedora-live-media]] +== How to reset the root password with a Fedora Live Media -* chroot to your installation: +[NOTE] -`chroot /mnt/sysimage/` +==== -* Change the root password: +To download and create a live USB of Fedora Workstation, follow the instructions on the link:++live-usb.html++[Fedora USB Live Media Quick Doc]. -`passwd` +==== -* Exit from the chroot: +. Boot the Live installation media and choose `Try Fedora` -`exit` +. From the desktop, open a terminal and switch to root using `su` (it won't ask for a password) -That's it, simply reboot your system and then boot the installation from -the HDD as usual. +. To view your hard drive device nodes, in the terminal type: `df -H`. +For this example we will use `/dev/sda1` for the `/boot` partition and `/dev/sda2` for the root `/` partition. ++ +If you are using LVM partitions, type: `sudo lvscan` and note the `/dev` path of your root partition. +For this example we will use `/dev/fedora/root`. -[[reset-password-when-bios-is-password-protected]] -Reset Password When BIOS is Password Protected -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +. Create a directory for the mount point (use the `-p` option to create subdirectories): ++ +[source,bash] -If you cannot enter rescue mode because you forgot the BIOS password -required to select an alternate boot device, you have three options: +---- -* Refer to your computer's documentation for instructions on resetting -the BIOS password in CMOS memory, usually by moving a physical jumper. -* Physically change the boot order. -* Temporarily move the system hard disk to another machine, and follow -the procedures above to reset the root password. +mkdir -p /mnt/sysimage/boot -Category:How_to -''' +---- -See a typo, something missing or out of date, or anything else which can be -improved? Edit this document at https://pagure.io/fedora-docs/quick-docs. +. Mount the `/` (root) partition (be sure to use the actual device node or LVM path of your root `/` partition): ++ +To mount root on a *standard partition* scheme enter: ++ +[source,bash] + +---- + +mount /dev/sda2 /mnt/sysimage + +---- ++ +To mount root on an *LVM partition* scheme enter: ++ +[source,bash] + +---- + +mount /dev/fedora/root /mnt/sysimage + +---- + +. Continue the process by mounting `/boot`, `proc`, `/dev`, and `/run` with: ++ +[source,bash] + +---- + +mount /dev/sda1 /mnt/sysimage/boot + +mount -t proc none /mnt/sysimage/proc + +mount -o bind /dev /mnt/sysimage/dev + +mount -o bind /run /mnt/sysimage/run + +---- + +. `chroot` to the mounted root partition with: ++ +[source,bash] + +---- + +chroot /mnt/sysimage /bin/bash + +---- + +. Change the root password: ++ +[source,bash] + +---- + +passwd + +---- + +. Exit out of chroot with: ++ +[source,bash] + +---- + +exit + +---- ++ +and exit out of the terminal. + +. Reboot your system and boot from the hard drive. + +Congratulations, your root password has been successfully changed. + +[[sect-additional-troubleshooting]] +== Additional Troubleshooting + +. If you cannot enter rescue mode because you forgot the Firmware/BIOS password here are some options: + +.. Refer to your computer's documentation for instructions on resetting the Firmware/BIOS password in CMOS memory. + +.. Temporarily move the system hard disk to another machine, and follow the procedures above to reset the root password. + +. If you have set a password for your boot loader, refer to link:++creating-and-using-a-live-installation-image.html++[Creating and Using a Live Installation Image]. + +. If you want to reset the boot loader password, refer to the instructions on how to link:++https://fedoraproject.org/wiki/Reset_Bootloader_Password++[Reset the Bootloader Password]. \ No newline at end of file