Giving sudo privilage to a user #33
ebrahimifard
started this conversation in
Solution
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Background
There are some tasks in Linux that requires superuser (sudo) permission. For instance editing the /etc/fstab file, rebooting the system, mounting a drive, viewing /etc/passwd file and many other tasks cannot be done without sudo privilege.
What this documentation will help achieve
This documentation helps you to give sudo privilege to a user.
Prerequisites
Tools/Software
Steps
Step 1. Getting the username(s) of sudo access candidates
You can get the usernames by checking the
/etc/passwd
file. This file contains all the usernames and their login information.Step 2. Navigating to the sudoers directory
The list of users who posses the sudo permission is in the
/etc/sudoers.d/
folder, so navigate to that folder.Step 3. Create an access file for each of the candidates
If you use
ls
command to check the available files in this folder, you can see there are some files that their name start with a number and then a dash and then a user name (<number>-<username>
). In Linux for every user with a sudo permission, there is a file like that, so we duplicate one of the existing files and rename them for each of the sudo candidates (in fact, name of those file doesn't matter; however, it helps us to understand which users have sudo privilege without opening them).Step 4. Editing the access files
In this step you need to open each of the newly duplicated files and replace the old username in the second line with the sudo candidate username. After the edit, you just save the changes and exit the file.
Beta Was this translation helpful? Give feedback.
All reactions