How to Give Sudo Privileges to a User in Linux 


               


How to Give Sudo Privileges to a User in Linux



Linux


In this article, we show how to give sudo privileges to a user in linux.

The root user, by default, has sudo privileges in a linux system.

If you create another user in linux and do not give sudo privileges to this user, it cannot carry out these administrative sudo commands.

Therefore, we need to give these users sudo privileges.

One reason why we give other users sudo privileges is because the root user can be a security compromise for a system. Many network administrators will disable root user login and will create another user than the root user and give this user some administrative privileges. This is so that no one outside can gain access to the root user and potentially wreak havoc on the system.

With the root user disabled, sudo privileges should be granted to another created user.

So how do we give sudo privileges to a user in linux?

So the first thing you must do is create another user othan the root user.

Simply create this user.

If you have already created this user, then make sure you're not logged in as this user.

You cannot be logged into the user and grant the user sudo privileges. You must be logged out and ideally you should be logged in as the root user.

Once the user is created and you are not logged in as the user, then type in the following line.



So what this following line of code does is it grants sudo privileges to the user, david, in the linux system, for whatever system you are using.

usermod allows for modification of the user settings.

sudo grants sudo privileges to the user, david.

The user, david, can now perform sudo commands in the Linux system and, thus, has administrative privileges in regard to this.

So giving sudo privileges to a user in linux is a powerful way to allow a user to have some administrative privileges, as are present in a root user.

And this is how to give sudo privileges to a user in linux.


Related Resources

How to Randomly Select From or Shuffle a List in Python



HTML Comment Box is loading comments...