Home > System Tutorial > LINUX > Reset Root Password In Fedora 39 Using Live USB: A Practical Guide

Reset Root Password In Fedora 39 Using Live USB: A Practical Guide

Jennifer Aniston
Release: 2025-03-20 09:35:20
Original
867 people have browsed it

This tutorial guides you through recovering your forgotten Fedora root password using a Fedora Live USB. This method is useful if the single-user mode approach fails.

Step 1: Prepare a Bootable Fedora Live USB

Download the Fedora Workstation Live image from the official Fedora website. Create a bootable USB drive using a tool like Fedora Media Writer or Ventoy.

Step 2: Boot from the Live USB

Insert the USB drive and boot your system from it. You may need to adjust your BIOS/UEFI settings to prioritize USB boot.

Reset Root Password In Fedora 39 Using Live USB: A Practical Guide

Step 3: Locate and Mount Your System's Root Partition

Open a terminal in the Live environment. Use lsblk or fdisk -l to identify your Fedora root partition (often marked with a filesystem type like ext4). Remember, the Live environment's root partition is separate from your installed system's root partition.

To find your installed system's root partition:

  1. List Partitions: Use lsblk to list all block devices. Identify partitions on your hard drive (e.g., /dev/sda1, /dev/sda2).
$ lsblk
Copy after login

Example output (your partition will vary):

<code>NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
loop0         7:0    0  1.9G  1 loop 
loop1         7:1    0  7.6G  1 loop 
├─live-rw   253:0    0  7.6G  0 dm   /
└─live-base 253:1    0  7.6G  1 dm   
loop2         7:2    0   32G  0 loop 
└─live-rw   253:0    0  7.6G  0 dm   /
sda           8:0    0   50G  0 disk 
├─sda1        8:1    0    1M  0 part 
├─sda2        8:2    0    1G  0 part 
└─sda3        8:3    0   49G  0 part 
sr0          11:0    1    2G  0 rom  /run/initramfs/live
zram0       252:0    0  7.7G  0 disk [SWAP]</code>
Copy after login

Reset Root Password In Fedora 39 Using Live USB: A Practical Guide

  1. Mount the Root Partition: Create a mount point and mount the identified partition. (Replace /dev/sda3 with your partition):
$ sudo mkdir /mnt/myroot
$ sudo mount /dev/sda3 /mnt/myroot
Copy after login
  1. Verify the Mount: Check the mount with df -h:
$ df -h /mnt/myroot
Copy after login
  1. Inspect Contents: Change directory and list contents to confirm it's the root partition:
$ cd /mnt/myroot
$ ls
Copy after login

You should see directories like bin, etc, home, usr.

Step 4: Enter the Chroot Environment

Change root into your system:

$ sudo chroot /mnt/myroot
Copy after login

Step 5: Reset the Root Password

Reset the root password:

# passwd
Copy after login

Enter and confirm your new password.

Step 6: Unmount and Reboot

Exit the chroot environment and unmount the partition:

# exit
$ sudo umount /mnt/myroot
Copy after login

Remove the Live USB and reboot your system.

Step 7: Log In with the New Password

Boot into Fedora and log in using your new root password.

Reset Root Password In Fedora 39 Using Live USB: A Practical Guide

Reset Root Password In Fedora 39 Using Live USB: A Practical Guide

This advanced method avoids single-user mode. Remember to exercise caution and back up important data before attempting these steps. If unsure, seek assistance from a Linux expert.

The above is the detailed content of Reset Root Password In Fedora 39 Using Live USB: A Practical Guide. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template