How to change root password in Fedora?


A root user is a most privileged user account in a Unix-based operating system. It has access to all the commands and files of a system.

It requires root user permissions to perform administrative tasks such as installing or removing a software package, changing the ownership and permissions of files, managing other user accounts on a system, etc.

Today in this article I will discuss how to set or change the password on the root user account in Fedora Linux.

The root user

In most of Linux distributions, a standard root user account is created while the installation of the operating system but no password is assigned to it.

Fedora Linux comes sudo only by default which means you are given the ability to execute a task with root user permissions by using the sudo command. We can enable and set or change the password of the root user account from the Linux terminal.

How to change root user password

Follow the given steps to change the password of the root user account.

Open your terminal and execute the given command –

sudo passwd root

This will ask password of the current user who is logged in, enter the password, and press the enter to proceed.

Now create a password for your root account, password should be at least 8 characters long and include capital, small letters, numbers, and special characters.

Retype the password and then press the enter, if it displays the message ”passwd: all authentication tokens updated successfully.” mean you have changed the root account password on your Fedora system.

passwd

Log in as the root user

You have set up a password for the root user you can now login to your root user account. To login to the root user account first logout from the current user and then enter the username as root and the password that you set up for it and click on sign in.

If you want to change the user to root in your terminal then execute the given command –

sudo -

It will ask you to enter the root user password, enter it. Now you will be logged in as root.

root user login

How to disable the root User Account?

If you want you can disable the root account login then you can do this by using the commands that are given ahead. You can perform all the administrative tasks by using the sudo while executing a command.

Run the following commands to remove the password and lock the password for the root user –

sudo passwd -d root
sudo passwd -l root

If the above commands ask for your password, enter it to proceed.

The command line options used in the above commands are –

-d or --delete – The option will delete the password of a user and make a named account passwordless

-l or --lock – This option will disable the password of an account by changing it to a value that matches no possible encrypted value. It adds ! at the beginning of the password.

To know more about passwd command see its manual page by using-

man passwd

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.