This tutorial helps you to create a new user with Sudo privileges, allow sudo access to the existing accounts or remove sudo privileges from any account.
Create User with Sudo Access
The adduser is the default system command to create new users on your Fedora system. In Fedora systems, a default group is created with the name “wheel” having sudo privileges. So we can assign sudo privileges to any user by adding them to the wheel group. Let’s create a new user “tecadmin” and also add them to a group “wheel”. Make sure to use -G in the capital, which is used for supplementary groups of the new account. Next, set a strong password for the new account.
Assign Sudo Privileges to User
Use the usermod command for making changes in the existing accounts. In this case, a user tecadmin has already been created on your system. Now add this user to a secondary group wheel. That will provide sudo privileges to your existing account. To add user to wheel group, type: This will just add tecadmin user to the wheel group. One can verify the same in the /etc/group file.
Remove Sudo Privileges from User
The gpasswd is an command-line utility for managing /etc/groups and /etc/shadow. With the help of this command, you can add or remove any user from groups. Use the following command to remote remove tecadmin account from wheel group. We also recommend viewing the /etc/sudoers file and removing any user-specific entries.
Conclusion
In this tutorial, we have discussed creating a Sudo account in the Fedora Linux system. Also includes commands to allow sudo access to the existing accounts as well as remove sudo privileges from the existing account.