To make user as sudo user we need to use below:
$ su
> Enter root password: *******
$ visudo -f /etc/sudoers
Find the following section of /etc/sudoers
file and add your users privileges:
# User privilege specification
root ALL=(ALL:ALL) ALL
user_name ALL=(ALL) ALL
make a backup of the sudoers files as follows:
# cp /etc/sudoers /etc/sudoers.orginal
# visudo
Add the user like below:
#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
## Next comes the main part: which users can run what software on
## which machines (the sudoers file can be shared between multiple
## systems).
## Syntax:
##
## user MACHINE=COMMANDS
##
## The COMMANDS section may have other options added to it.
##
## Allow root to run any commands anywhere
root ALL=(ALL) ALL
## Allows members of the 'sys' group to run networking, software,
## service management apps and more.
# %sys ALL = NETWORKING, SOFTWARE, SERVICES, STORAGE, DELEGATING, PROCESSES, LOCATE, DRIVERS
## Allows people in group wheel to run all commands
%wheel ALL=(ALL) ALL
## Same thing without a password
# %wheel ALL=(ALL) NOPASSWD: ALL
## Allows members of the users group to mount and unmount the
## cdrom as root
# %users ALL=/sbin/mount /mnt/cdrom, /sbin/umount /mnt/cdrom
## Allows members of the users group to shutdown this system
# %users localhost=/sbin/shutdown -h now
## Read drop-in files from /etc/sudoers.d (the # here does not mean a comment)
#includedir /etc/sudoers.d
tonu ALL=(ALL) ALL
oracms ALL=(ALL) ALL
Setting Correct Permission on sudoers File
# chmod 0440 /etc/sudoers
Comments
Post a Comment