How to Create a New Sudo User on Fedora 39, 38 Linux

Learning to create a new sudo user on Fedora Linux is a fundamental skill for system administrators and those looking to manage permissions effectively. This guide will demonstrate precisely how to do this, ensuring you have complete control over your system’s security and user management. By following these steps, you’ll seamlessly add a new user with sudo privileges, enabling them to perform tasks that require administrative rights.

Key Features of This Process:

  • Simple and Clear Steps: Designed to be straightforward, even for beginners.
  • Secure Practices: Focus on maintaining the security integrity of your Fedora Linux system.
  • Versatility: Applicable for various Fedora versions, ensuring broad relevance.
  • Practical Use Cases: Ideal for setting up new workstations, and servers or managing multiple users.

The process is not just about adding a user; it’s about empowering your Fedora system with flexibility and control. Whether setting up a new server or ensuring your team members have the necessary access, these steps will be your go-to resource.

Change to Root Account on Fedora Linux

When managing Fedora Linux, operating as the root user is essential to create new sudo users. If you haven’t set the root password during installation, don’t worry—it’s a straightforward process.

Begin by resetting the root password using the following command:

sudo passwd root

Upon executing this command, enter your current sudo account’s password first. Then, you’ll be prompted to create a new password for the root account. This step is crucial for securing root access.

Resetting root password on Fedora Linux
How to Reset Your Forgotten Root Password in Fedora

Once the root password is set, switch to the root account using the su command. This step gives you full administrative access necessary for creating and managing sudo users:

su

After entering this command, you’ll be prompted to type in the new root password. Successfully doing so changes your session to operate under the root user, indicated by the change in the username display to ‘root’ instead of your regular username.

Logging into root account on Fedora Linux
Entering the Root Account for System Administration

Now, with root@ in your command prompt, instead of @username, you have full administrative privileges to proceed with user management tasks on your Fedora Linux system. This elevated access is critical for the subsequent steps in creating a new sudo user.

Create a User Account on Fedora Linux

To begin setting up a new user on your Fedora Linux system, start by creating a user account. This is achieved with the adduser command. Replace <example username> with the desired username for the new account.

For example, to create a user named ‘josh’, the command would be:

adduser josh

This command establishes a new user account named ‘josh’ on the system. It’s a critical first step in user management, allowing for personalized access and security.

Following the creation of the user account, it’s important to assign a secure password to the new user. Continuing with our example, to set a password for ‘josh’, use the following command:

sudo passwd josh

Executing this command will prompt you to enter and confirm a new password for ‘josh’. This step is vital for securing the new account and ensuring that only the intended user can access it.

Adding a new user in Fedora Linux terminal
Step-by-Step User Addition in Fedora

Add New Created User To Sudoers Group on Fedora

After creating a new user account on Fedora Linux, the next critical step is granting sudo privileges. This allows the user to perform administrative tasks, enhancing their system access and capabilities. To add a user to the sudoers group, which is known as the ‘wheel’ group in Fedora, use the usermod command with the -aG options. These options append the user to the specified group.

Replace <example username> with the actual username. For instance, to add ‘josh’ to the sudoers group, the command is:

usermod -aG wheel josh

This command effectively grants ‘josh’ administrative privileges by adding him to the ‘wheel’ group.

To verify that the user has been successfully added to the sudoers group, use the id command. This command displays the user’s groups. For example, to check ‘josh’s group memberships:

id josh

This command will show you the groups that ‘josh’ belongs to, including ‘wheel’ if the previous step was successful.

Verifying new sudo user with id command in Fedora Linux
Confirming Sudo Access for New Users

Alternatively, the gpasswd command can also be used to add a user to a group. This method is equally effective and straightforward.

To add ‘josh’ to the ‘wheel’ group using gpasswd, the command is:

gpasswd -a josh wheel

Upon execution, this command will display a confirmation, such as “Adding user josh to group wheel,” indicating the successful addition of the user to the group.

Adding user josh to group wheel

Both usermod and gpasswd are reliable methods for managing group memberships in Fedora Linux, crucial for proper system administration and user access control.

Confirm New Created Sudo User on Fedora Linux

After granting sudo access to the newly created user, verifying that the account is set up correctly is crucial. This involves testing the user’s ability to execute commands with sudo privileges. To begin, switch to the new user account using the su command.

Replace <example username> with the actual username. For instance, to switch to the user ‘josh’, the command is:

su josh

Once logged in as the new user, confirm their sudo access by using the sudo command followed by whoami. This command displays the username that is executing the command, which should reflect the root user if sudo is functioning correctly.

Execute the following:

sudo whoami

Upon entering this command, you’ll be prompted to enter the password for the sudo user you’re currently logged in as. After successfully entering the password, the output should confirm that you are operating with root privileges.

Switching to new root user and confirming sudo access on Fedora Linux
Ensuring Root Access for New Users in Fedora Linux

This step is vital to ensure that the user has the necessary administrative rights and that the setup process is completed accurately. Proper verification of sudo access is a key aspect of managing user permissions securely on Fedora Linux.

Conclusion and Final Thoughts

In this guide, we’ve navigated through adding a new user and granting them sudo privileges on Fedora Linux, all using the command line interface. These steps are fundamental for anyone working with Linux, ensuring you can confidently manage user access and administrative permissions. Remember, regularly verifying user permissions and checking sudo access is key to maintaining your system’s security.

Leave a Comment


Your Mastodon Instance
Share to...