com
Originally published on
LinuxTechLab.com
It has always been advised that use of root account should be limited, as root has
access to anything & everything on a Linux system. And also sharing root password to a
number of users is clearly a security threat, but use of roots administrative right might
be necessity in some cases. So we can provide some trusted users with sudo
access/administrative rights without actually sharing roots password with them.
After they are given the access, trusted users can then run any command prefixed with
sudo & will then be prompted for a password. Once authenticated , command is
executed as if it has been executed by root account.
Once all the users have been added, we will now edit /etc/sudoers file. Sudoers file is
define policies applied to sudo. To edit the file, run
$ visudo
This will open the file /etc/sudoers, we now need to find section that contains wheel
group.
## Allows people in group wheel to run all commands
# %wheel ALL=(ALL) ALL
Search for wheel & uncomment the line by removing # (its commented by default).
Save & then exit the file after editing it. Now we will add all our users to group wheel.
To add a user to group wheel, run
$ usermod -aG wheel dan
Similarly, add other users as well. Now all the added users have administrative privileges
To check , log in as a local user & run any command with adding sudo before command,
$ su dan
$ sudo systemctl restart network
You will be presented with the following output on the screen, enter the password for
user & command will be executed.
We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:
#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.
[sudo] password for dan:
If you think we have helped you or just want to support us, please consider these :-
Connect to us: Facebook | Twitter | Google Plus
LinuxTechLab.com