Providing Root Privileges User/Group in Linux

If we need to provide any user the privileges as root user to perform any administrative task, we can do via giving sudo access.

The important commands and file related to provide these privileges are as below:

1) File which Controls this privilege


2) If we want to edit /etc/sudoers file then use following command


3) We need to change permission in below line in /etc/sudoers file.

4) Syntax for adding sudo permission

username host_list = (users) command

username : This corresponds to the user to which sudo access need to be provided
host_list: This defines the hosts on which the user is allowed sudo access
users: This defines the users as which ‘username’ can execute the commands
command : This defines the commands that the user is allowed to execute as root/another user.

5)  Allow a specific user to run any commands as any user in any hosts

 himanshu ALL=(ALL) ALL

6) Allow users in a specific group to run any command(like dba is the group in my system)

%dba ALL=(ALL) ALL

7) Allow user to run commands without authenticating


8) Run the previously executed command in sudo

sudo !!