Now the user will be allowed to run the sudo commands, like we have tried the “ sudo apt update” command: In the output, you should see the sudo group. In our scenario, the command would be: $ groups ummara The groups command tells which groups a user belongs to. To confirm the user is now in the sudoers, issue the command below: $ groups The members of sudo group are allowed to run the sudo commands.įor instance, to add a user named “ummara” to sudoers, the command would be: $ sudo usermod -aG sudo ummaraĮnter the sudo password, after which the user will be added to the sudo group. This command will add user to a group named “sudo”. To add a user to sudoers and assign it sudo privileges, use the usermod command as follows: $ sudo usermod -aG sudo username Method #1 By Adding User to the sudo group (Command Line) Remember, you will need to run the commands described here as a root or sudo. There are different methods to add a user to sudoers on Ubuntu. The following output shows the user “ummara” is a member of sudo groups and therefore has sudo privileges. If the user has sudo rights, you will see the “sudo” group in the output.įor instance, to check if a user named “ummara” has sudo access, the command would be: $ groups ummara You can check it using the command below in the Terminal: $ groups To find out if a user has sudo rights, you will need to check if it is a part of the group “sudo”. You can use the same procedures on other Linux distributions that use sudo. Note: For the demonstration, we will be using the Ubuntu 20.04 LTS. If you are interested in how to add a new user in Linux, visit our post on How to How to Add and Remove Users on Ubuntu 20.04. We will explain each method with example. To add a user to sudoers (list of users who can run sudo commands) on Ubuntu, there are three different methods including both the command line and the GUI. The sudo command lets you do this by allowing a user to run all or a specific set of commands as a root user. However, there are some users whom you want to assign root privileges to perform all or a limited number of duties. But, practically you cannot give every user all privileges to do whatever they want to do with a system. Without root privileges, a normal user is very limited in what they can do in Linux. The sudo command in Linux allows you to run all those commands which require root privileges.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |