How to reset passwords on Fedora 21 and 22

Fedora 21 touch .autorelabel

Thanks to a very strict password policy and one too many passwords to remember, I managed to forget both the root and user account passwords of a test Fedora 21 installation. I could have reinstalled the whole system, but decided that the situation presented a good opportunity to attempt a password recovery.

Luckily, performing a password reset operation on a Linux distribution is a relatively simple operation. So simple that anybody with physical access to your computer can do it. That means anybody, whether they are authorized to or not.

And that presents a good case why users should always configure full disk encryption and/or password-protect GRUB, the default bootloader on virtually all Linux distributions.

So what follows is a step-by-step guide on how to recover a password on Fedora 21. The same steps should apply to Fedora 20 and the upcoming Fedora 22. The password being reset can be the root password or a standard user account password.

A password recovery attempt in Linux begins at the GRUB boot menu. Figure 1 shows what it looks like on Fedora 21, where the default entry is selected. That’s the entry that you’ll have to edit to begin the password reset operation. And that entails pressing the E key on the keyboard.

Fedora 21 GRUB
Figure 1: Entries on the GRUB menu of Fedora 21.

Afterwards, you’ll see a window like the one shown in Figure 2. There’s only one long line that you’ll need to edit, but you’ll have to scroll down to see it. To scroll down, keep pressing the Down arrow key on the keyboard until you get to a line that begins with linux16.

Fedora 21 edit GRUB options
Figure 2: Editable GRUB entries on Fedora 21.

Figure 3 shows the options on that line. It’s a very long line, so you’ll have to use to Left arrow key to move the cursor until it reaches the end of the line. Note that the options span two lines. The line break is marked by the backslash (\).

Fedora 21 edit GRUB
Figure 3: The line that needs to be edited to boot into single user mode on Fedora 21.

To reset the password, the system has to be booted into single user mode. To cause that to happen, add rw followed by a space then followed by init=/bin/bash to the end of the line. In the example shown in Figure 4, I had to type the new options on a new line. That’s the reason for the new backslash just before rw. After typing the new options, reboot by pressing Ctrl X.

Fedora 21 edit GRUB
Figure 4: Appending the necessary options for single-user mode booting on Fedora 21.

The system will reboot into single user mode. In that mode, you’ll be operating with the privileges of the superuser. To emphasize, this is the reason why you should always password-protect GRUB or configure full disk encryption. Otherwise, any person that gains physical access to your computer can use this same method to reset the password.

Fedora 21 reset password
Figure 5: Single user mode on Fedora 21.

To reset the password for the root account, type passwd, then press the ENTER key. To reset the password for a standard user account, type passwd followed by the target username. In the example shown in Figure 5, I reset the password of a user called kamit. In either case, you’ll be prompted to type the password twice. If the password-reset attempt is successful, the system will output passwd: all authentication tokens updated successfully.

Related Post:  Fedora 15 Xfce review

Afterwards, type touch / .autorelabelto address an issue with SELinux. Finally, reboot the system by typing /sbin/reboot -f.

Fedora 21 reset root password
Figure 6: Resetting a user account password on Fedora 21.

As the system reboots, there will be a brief pause at the juncture shown in Figure 7. Don’t worry, SELiux targeted policy relabeling takes just a couple of minutes. When rebooting has completed, you should be looking at a familiar login screen. Log in with the new password, if you changed the standard user password.

Fedora 21 touch .autorelabel
Figure 7: SELinux policy relabeling after changing a password on Fedora 21.

Share:

Share on facebook
Facebook
Share on twitter
Twitter
Share on pinterest
Pinterest
Share on linkedin
LinkedIn

Hola! Did you notice that LinuxBSDos.com no longer run network ads?  Yep, no more ads from the usual suspects that track and annoy you across the Internet. But since I still need to pay to keep the site running, feel free to make a small donation by PayPal or your favorite cryptocurrency.

  • Bitcoin
  • Ethereum
  • Xrp
  • Bitcoin cash
  • Bitcoin sv
  • Litecoin
  • Binance coin
  • Cardano
  • Ethereum classic
Scan to Donate Bitcoin to bc1qzvlte2m224zkayhdc7fdfjkp2rsgt0l5a496ua

Donate Bitcoin to this address

Scan the QR code or copy the address below into your wallet to send some Bitcoin

Scan to Donate Ethereum to 0x0F4362DFF77F3Ba0Dc637F5f3Eba35D09a2fA60C

Donate Ethereum to this address

Scan the QR code or copy the address below into your wallet to send some Ethereum

Scan to Donate Xrp to r4ggjvL36njsMCYTkJ3S7cTHscPsMsSGQv

Donate Xrp to this address

Scan the QR code or copy the address below into your wallet to send some Xrp

Scan to Donate Bitcoin cash to qrs0dedzp9t55af3nfwypydghp29r0xguy9s20fz2k

Donate Bitcoin cash to this address

Scan the QR code or copy the address below into your wallet to send some Bitcoin cash

Scan to Donate Bitcoin sv to 15K9TLyVDBtLuG9cYvXCX9SSkq9C9oUKHK

Donate Bitcoin sv to this address

Scan the QR code or copy the address below into your wallet to send some Bitcoin sv

Scan to Donate Litecoin to LetJ9QQMb7u2LMZ9Tu6rtHwcBcQFW98fbG

Donate Litecoin to this address

Scan the QR code or copy the address below into your wallet to send some Litecoin

Scan to Donate Binance coin to bnb1ga8trq08ssqepd90v6225nzfgy448pu5pw8gxp

Donate Binance coin to this address

Scan the QR code or copy the address below into your wallet to send some Binance coin

Scan to Donate Cardano to addr1qx2354yw49etstfljpdhwja3ajjlt487lg95vu9ngy2q6vu4rf2ga2tjhqknlyzmwa9mrm997h20a7stgectxsg5p5esq5l7d9

Donate Cardano to this address

Scan the QR code or copy the address below into your wallet to send some Cardano

Scan to Donate Ethereum classic to 0xcD6CC972a2297FcafACDcfE042C55C69516a9264

Donate Ethereum classic to this address

Scan the QR code or copy the address below into your wallet to send some Ethereum classic

Subscribe for updates. Trust me, no spam!

Sponsored links

1. Attend Algorithm Conference, a top AI and ML event.
2. Reasons to use control panel for your server.
3. DHgate Computers Electronics, Cell Phones & more.

Upcoming events

19 Responses

Leave a Reply

Your email address will not be published. Required fields are marked *

Get the latest

On social media
Via my newsletter

Partner links

1. Attend Algorithm Conference, a top AI and ML event for 2021.
2. Reasons to use control panel for your server.
3. DHgate Computers Electronics, Cell Phones & more.
Hacking, pentesting distributions

Linux Distributions for Hacking

Experts use these Linux distributions for hacking, digital forensics, and pentesting.

Categories
Archives

The authors of these books are confirmed to speak during

Algorithm Conference

T-minus AI

Author was the first chairperson of AI for the U.S. Air Force.

The case for killer robots

Author is the Director of the Center for Natural and Artificial Intelligence.

Why greatness cannot be planned

Author works on AI safety as a Senior Research Scientist at Uber AI Labs.