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 Linux Mint.You can use the sudo user to perform administrative tasks on your Fedora server without a need to log in as the root user.
Before you start to create
sudo user on Linux Mint. You must have the root user of your system.
Create a sudo User
first,log in to your system or ssh your server as a root user.
Now, create a new user account using the
adduser command. Don’t forget to replace
new_username with the user name that you want to create:
Here you will be prompted to enter the password for the user you want to create and confirm it. Enter a strong password for the new user you are creating:
New password: Retype new password: passwd: password updated successfully
After setting the password, it will create the HOME directory for the user saving some configuration files. Then it will ask you some more information about that user.If you want to leave all of this information blank just press
ENTER to accept the defaults.
Changing the user information for username Enter the new value, or press ENTER for the default Full Name : Room Number : Work Phone : Home Phone : Other : Is the information correct? [Y/n]
By default on Linux Mint systems, members of the group sudo are granted with sudo access. To add the user you created to the sudo group use the usermod command:
usermod -aG sudo new_username
Test the sudo user access
Now you switch to new account using
su command to do so run below command:
su - new_username
Then,use the sudo command to run the
If the user have sudo access then you will get below output:
How to use sudo
For example,you can use sudo to display contents of
sudo ls -la /root
The first time you use sudo in a terminal session, you will be prompted to enter the user password:
[sudo] password for username:
You have learned how to create a user with sudo privileges. You can now log in to your Linux Mint server with this user account and use sudo to run administrative commands.
If you have any queries regarding this then please don’t forget to comment below.