Table of Contents

sudo - How to Configure sudo in Linux



Configuration

Example

Permit

root ALL=(ALL) ALL
user01 ALL=(ALL) NOPASSWD:ALL
apache ALL=(user01) NOPASSWD:ALL

Deny

Cmnd_Alias SHUTDOWN = /sbin/halt, /sbin/shutdown, /sbin/poweroff, /sbin/reboot, /sbin/fastboot, /sbin/init
Cmnd_Alias REMOVE = /bin/rm, /usr/sbin/unlink, /bin/rmdir

%dev ALL=(ALL) ALL, !SHUTDOWN,!REMOVE
#deny "sudo -s"
Cmnd_Alias SHELLS = /bin/sh, /bin/csh, /bin/tcsh, /bin/bash, /usr/local/bin/bash
Cmnd_Alias SHELLS_NONINTERACTIVE = /bin/sh -c *, /bin/csh -c *,/bin/tcsh -c *, /usr/local/bin/bash -c *

%dev ALL=(ALL) ALL, !SHELLS, SHELLS_NONINTERACTIVE