Reset the Root Password on Fedora
source link: https://www.vultr.com/docs/reset-the-root-password-on-fedora
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Using a Different System?
- Reset Passwords and SSH Keys in Fedora CoreOS
- Reset Windows Server Administrator Password
- Reset the Root Password on CentOS
- Reset the Root Password on CoreOS
- Reset the Root Password on Debian
- Reset the Root Password on FreeBSD
- Reset the Root Password on Ubuntu
- Reset the Root Password on OpenBSD
- Reset the Root Password on AlmaLinux
- Reset the Root Password on Rocky Linux
- Reset the Root Password on VzLinux
- Reset the Root Password on Arch Linux
- How to Reset the Root Password in Single-User Mode
Introduction
If you are locked out of your Fedora instance and have lost access to the root account, you need to boot into single-user mode and reset the root password. These steps apply to Fedora versions 29 through 35.
Connect to the Console
Click the Server Restart icon in the Vultr customer portal.
Open the web console.
You can also reboot the server from inside the web console. See the Web Console FAQ for more information.
Follow the steps below for your version.
How to Reset the Root Password on Fedora 29 through 33
- As the system boots, press ESC to bring up the GRUB boot prompt. The prompt happens early in the boot process. If you miss the prompt, you need to restart the server from the control panel and try again.
- At the GRUB boot prompt, press E to edit the first boot option.
- Find the kernel line starting with linux
- Change
ro
torw init=/sysroot/bin/sh
. - Press CTRL+X or F10 to boot into single-user mode.
- Access the system with the command:
chroot /sysroot
. - The system will boot, and you will see the root prompt.
- Run
passwd
to change the root password. - Run
touch /.autorelabel
to force file system relabeling. - Run
exit
. - Run
logout
. - Run
reboot
to reboot the server.
How to Reset the Root Password on Fedora 34 & 35
- As the system boots, press ESC to bring up the GRUB boot prompt. The prompt happens early in the boot process. If you miss the prompt, you need to restart the server from the control panel and try again.
- At the GRUB boot prompt, use the arrow keys to highlight one of the rescue kernels and press E to edit the boot options.
- Find the kernel line starting with linux.
- Change
ro
torw init=/sysroot/bin/sh
. - Press CTRL+X or F10 to boot into single-user mode.
- Press ENTER to enter maintenance mode.
- Access the system with the command:
chroot /sysroot
. - Type
passwd
and follow the prompts to change the root password. - Run
touch /.autorelabel
to force file system relabeling. This is required for systems with SELinux. When you reboot the system, it will relabel the filesystem for SElinux. The reboot may take extra time during this process. - Run
exit
. - Run
reboot
to reboot the server.
Want to contribute?
You could earn up to $600 by adding new articles
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK