I am using fedora. but I don't know my root password. how to I find my root password? If then how to I change my root password?

Dani AI

Generated

You cannot “discover” the current root password — Linux stores passwords as one‑way hashes (not reversible), so the practical option is to reset the root password rather than recover it. (techtarget.com)

If your regular account already has administrative (sudo) rights — exactly the situation described — elevate to an administrative shell and run the system password-change tool to set a new root password. That is the simplest and safest path when it’s available. (docs.fedoraproject.org)

If you do not have sudo, use rescue mode or boot from Fedora live media and reset root from the installed filesystem. Typical rescue steps are: interrupt GRUB, edit the chosen kernel entry and append a rescue parameter (examples shown below), boot the modified entry, remount the real root read/write, chroot into it, and then run the system password-change utility. After changing the password, force or perform an SELinux relabel before booting normally. Example kernel parameters and actions commonly used for modern Fedora systems:

rw init=/bin/bash
# or, on systemd systems:
rd.break enforcing=0

and inside the rescue environment:

mount -o remount,rw /sysroot
chroot /sysroot
# run the system password-change utility here (set a new root password)
# then create an SELinux relabel marker or restore the shadow label:
touch /.autorelabel
# or later as root: restorecon -v /etc/shadow ; setenforce 1

Follow the Live-USB method if you cannot edit GRUB (boot the live image, mount the installed root, bind /dev /proc /run, chroot and change the password). If the disk is LUKS-encrypted or the firmware/bootloader has a password, those add extra steps (you may be prompted for the LUKS passphrase, or need to remove the drive). See the Fedora reset-root documentation and the Fedora Magazine notes on using rd.break and SELinux relabeling for the exact procedure and cautions. (docs.fedoraproject.org)

For quick reading, ’s Fedora basics pointer is useful for general orientation; use the official reset instructions above when you need to reset the root account specifically.

Recommended Answers

All 3 Replies

Aslam o alikum: Sir I want to ask that how i can download free computer vitual basic plz solve my problm.

read this link, you will find all your answers: http://www.fedorafaq.org/basics/

Aslam o alikum. Please open a new thread and explain better your problem.

If you don't have the root password, but you have sudo privileges on your user account (i.e., you can run commands under sudo by entering your user password), then you can simply run this to become root in the terminal:

$ sudo su

And then, you can change the root password with the passwd command.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.