How to give normal user root privileges using sudo in Linux/Unix

In this post I will be very brief on the topic we need to do. As for more knowledge on sudo command and sudoers file follow the below link
Understanding syntax, arguments, aliases used in sudoers file with examples (visudo)
As per my knowledge there are two methods to do the same. I have tested these commands and methods in Red Hat Linux.
Method 1

# visudo
# Add an extra line in the last and make this entry
deepak    ALL=(ALL)   ALL

Using this above line you are telling your Linux box to give full permission for user deepak on all the hosts and all the commands

[deepak@test ~]$ sudo /etc/init.d/network restart
[sudo] password for test:
Shutting down interface eth0:  Device state: 3 (disconnected)
                                                           [  OK  ]
Shutting down loopback interface:                          [  OK  ]
Bringing up loopback interface:                            [  OK  ]
Bringing up interface eth0:  Active connection state: activated
Active connection path: /org/freedesktop/NetworkManager/ActiveConnection/1
                                                           [  OK  ]

Method 2
Add the user to wheel group

# usermod -G wheel deepak

Verify the same

# cat /etc/group | grep wheel

Now uncomment this line from sudoers file

# visudo
## Allows people in group wheel to run all commands
 %wheel ALL=(ALL)       ALL

The reason we did this because be default root is a member of wheel group so in case you want to give root level permission to any normal user then add him/her in wheel group.

$ sudo /etc/init.d/vsftpd restart
Shutting down vsftpd:                                      [  OK  ]
Starting vsftpd for vsftpd:                                [  OK  ]

Please let me know your success and failures.

9 thoughts on “How to give normal user root privileges using sudo in Linux/Unix”

  1. He must be having access via some public group
    To debug you can take a backup and clear your sudoers fileand then re-try
    if a user is part of wheel group then also they will get sudo access as by default wheel group is given sudoers permission


Leave a Comment