How to add entries to sudoers

Edit the file /etc/sudoers. Note that the file is read-only (even for su). You only need to use :w! in vi to force-write.

# /etc/sudoers

  1. This file MUST be edited with the ‘visudo’ command as root.
  2. See the man page for details on how to write a sudoers file.
  3. Defaults env_reset
  1. Host alias specification

User_Alias MYADMINS = jdoe

  1. User alias specification
  1. Cmnd alias specification

Cmnd_Alias SHUTDOWN = /sbin/shutdown, /sbin/reboot, /sbin/halt
Cmnd_Alias PKGMGMT = /usr/bin/dpkg, /usr/bin/apt-get, /usr/bin/aptitude

  1. User privilege specification
  1. Users listed above (MYADMINS) can run package managers and reboot the system.

MYADMINS ALL = PKGMGMT, SHUTDOWN

  1. Users in the group wheel can execute any command impersonating any user.

#%wheel ALL= ALL

#Default rule for root.
root ALL=(ALL) ALL

(Source: http://wiki.debian.org/sudo)

Advertisements