configure sudo with sudoers file

SUDO:

File: /etc/sudoers

MUST use sudovi to edit the file (don't use vi )

root ALL=(ALL) ALL

User Terminals=(ACT_AS_USER) COMMANDS

The root user can execute from ALL terminals, acting as ALL (any) users, and run ALL (any) command.

operator ALL= /sbin/poweroff
The above command, makes the user operator can from any terminal, run the command power off.


user01 ALL=(ALL) NOPASSWD: ALL

user01 can run all command from all terminals without an password.

user01 ALL=(root) NOPASSWD: \
/bin/true, \
/sbin/ifconfig, \
/bin/df -p, \
/bin/netstat --inet --inet6 -n -p -a -t, \
/sbin/fdisk -l, \
/bin/cat /sys/devices/virtual/dmi/id/*, \
/usr/sbin/dmidecode --type system, \
/usr/sbin/dmidecode --type chassis, \
/usr/sbin/dmidecode --type bios

#Remove the TTY restriction for user01
Defaults: user01 !requiretty

# Allow the user01 to issue command as root without a password
user01 ALL=(root) NOPASSWD: ALL

 

Add comment


Security code
Refresh

Category: