Working on the sudo command
The Sudo command performs the below tasks and permits the users to access root user facilities:
- Reads the /etc/sudoers file and looks for the user who invoked the command.
- Then the user is prompted for a password, this can be skipped by using the NOPASSWD flag.
- A child process[setuid()] is then created, which switches the target to the user.
- All the commands which are given now will be executed in the child process.
The sudo files which can be modified using Default entries can be found in the /etc/sudoers file. Use the below command to get a list of all the entries currently present.
sudo cat /etc/sudoers
In this article we will be looking at 9 different sudo configurations and the Linux distro used will be Ubuntu.
Useful Sudoers Configuring sudo Command in Linux
In operating systems such as Linux and Unix, the liberty to run all the commands lies in the hand of the root user. The root user can perform various tasks such as installation, updating the system, removal of certain packages, creating groups and users, modification of config files, etc. The system administrator who has the role of the root user can grant other users the power to use all the other commands with the help of the sudo command. Apart from this, the system admin can also share the root password (not recommended) so that other users can access all the tasks with the su command.