Sudo is a system management command, sudo allows a permitted user to execute a command as the superuser or another user, as specified by the security policy.
In this article, we will show you how to create a new user with sudo privileges on Fedora.You can use the sudo user to perform administrative tasks on your Fedora server without a need to log in as the root user.
Create sudo user
If you want to configure sudo for an existing user, just add your user to the
How to Create a sudo user on your Fedora server, follow the steps below:
Step 1,log in to your Fedora server as the root user, run the command in your terminal.
Step 2,Create a new user account on your Fedora server by typing follow command:
In this tutorial,
linuxhowto is used as a sample user. You can replace it with the user you want to create on your fedora server .
Step 3,you can use the
passwd command to set a password for the new user.
You will be prompted to confirm the password. I suggest you use a strong password.
Changing password for user linuxhowto. New password: Retype new password: passwd: all authentication tokens updated successfully.
Fourth,add the new user to the
/etc/sudoers configuration file.
echo 'linuxhowto ALL=(ALL) ALL' > /etc/sudoers
Use sudo command
Switch to the newly created user and execute the following command：
su - linuxhowto
Execute commands that require sudo privileges in the following ways：
For example, to list the contents of the
/root directory you would use:
sudo ls -l /root
The first time you use sudo to execute commands under this account,you will see the following message and you will be prompted to enter the password for the user account.
[sudo] password for linuxhowto:
linuxhowto is the previously created user name。
By default, sudo will not ask for a password again within 15 minutes of entering the password. After 15 minutes, you will be asked to enter your password again.
In this tutorial, we have explained how to Create Sudo user on Fedora. If you have any questions or thoughts to share, please leave a comment to reach us.