Not found locally for sudoers. Try Google search
sudoers — default sudo security policy plugin
| Use Case | Command | Description |
|---|---|---|
| Allow user to run any command | username ALL=(ALL:ALL) ALL | Grant full sudo access to a user |
| Allow group to run specific commands | %group ALL=/usr/bin/apt,/usr/bin/systemctl | Restrict a group to only certain commands |
| Run command as another user | sudo -u operator /bin/ls | Execute command as a different user |
| Edit files securely with sudoedit | sudoedit /etc/fstab | Edit files with your own editor, root-owned copy |
| Run command without password | username ALL=(ALL) NOPASSWD:ALL | Skip password prompt for specified commands |
| Set environment variable preservation | Defaults env_keep+="DISPLAY HOME" | Keep specific environment variables for commands |
| Log all commands | Defaults log_input,log_output | Enable I/O logging for all sudo commands |
| Use LDAP for sudoers | sudoers: files ldap in nsswitch.conf | Store sudo rules in LDAP directory |
The sudoers policy plugin determines a user's sudo privileges. It is the default sudo policy plugin. The policy is driven by the /etc/sudoers file or, optionally, in LDAP. The policy format is described in detail in the SUDOERS FILE FORMAT section. For information on storing sudoers policy information in LDAP, please see sudoers.ldap(5).
sudo consults the sudo.conf(5) file to determine which plugins to load. If no sudo.conf(5) file is present, or if it contains no Plugin lines, sudoers will be used for auditing, policy decisions and I/O logging. To explicitly configure sudo.conf(5) to use the sudoers plugin, the following configuration can be used.
Plugin sudoers_audit sudoers.so
Plugin sudoers_policy sudoers.so
Plugin sudoers_io sudoers.so
Starting with sudo 1.8.5, it is possible to specify optional arguments to the sudoers plugin in the sudo.conf(5) file. The following plugin arguments are supported:
The sudoers security policy requires that most users authenticate themselves before they can use sudo. A password is not required if the invoking user is root, if the target user is the same as the invoking user, or if the policy has disabled authentication. Unlike su(1), when sudoers requires authentication, it validates the invoking user's credentials, not the target user's (or root's) credentials. This can be changed via the rootpw, targetpw and runaspw flags.
If a user who is not listed in the policy tries to run a command via sudo, mail is sent to the proper authorities. The address used for such mail is configurable via the mailto Defaults entry and defaults to root.
sudoers uses per-user time stamp files for credential caching. Once a user has been authenticated, a record is written containing the user-ID used, the terminal session ID, the start time of the session leader, and a time stamp (using a monotonic clock if available). The user may then use sudo without a password for a short period of time (15 minutes unless overridden by timestamp_timeout).
By default, sudoers logs both successful and unsuccessful attempts (as well as errors). The log_allowed and log_denied flags can be used to control this behavior. Messages can be logged to syslog(3), a log file, or both. The default is to log to syslog(3) but this is configurable via the syslog and logfile settings.
sudoers is also capable of running a command in a pseudo-terminal and logging all input and/or output. I/O logging can be enabled using the log_input and log_output options as well as the LOG_INPUT and LOG_OUTPUT command tags.
Starting with version 1.9, the log_servers setting may be used to send event and I/O log data to a remote server running sudo_logsrvd.
Since environment variables can influence program behavior, sudoers provides a means to restrict which variables from the user's environment are inherited by the command to be run. By default, the env_reset flag is enabled, causing commands to be executed with a new, minimal environment. The env_check, env_keep, and env_delete options allow fine-grained control.
Environment variables with a value beginning with () are removed unless both the name and value parts are matched by env_keep or env_check, as they may be interpreted as functions by the bash shell.
Other sudoers options may influence the command environment, such as always_set_home, secure_path, set_logname, and set_home.
If the -i option is specified, sudoers will initialize the environment regardless of the value of env_reset.
The sudoers file is composed of two types of entries: aliases (basically variables) and user specifications (which specify who may run what). When multiple entries match for a user, they are applied in order. Where there are multiple matches, the last match is used.
By default, sudoers uses the operating system's native method of setting resource limits for the target user. Resource limits may also be set in the sudoers file itself, in which case they override those set by the system. Resource limits can be specified in one of the following formats:
"value" — Both soft and hard limits set to the same value."soft,hard" — Two comma-separated values."default" — Use the default resource limit for the user."user" — Preserve the invoking user's resource limits.For example: Defaults rlimit_core=default
EBNF is a concise way of describing the grammar of a language. Symbols and operators:
? — Optional (zero or one)* — Zero or more+ — One or more'' denote verbatim character strings.There are four kinds of aliases: User_Alias, Runas_Alias, Host_Alias and Cmnd_Alias. (Beginning with sudo 1.9.0, Cmd_Alias may be used in place of Cmnd_Alias.)
Each alias definition is of the form:
Alias_Type NAME = item1, item2, ...
Where NAME is a string of uppercase letters, numbers, and underscores, starting with an uppercase letter.
Certain configuration options may be changed from their default values at run-time via one or more Default_Entry lines. These may affect all users on any host, all users on a specific host, a specific user, a specific command, or commands being run as a specific user. Parameters may be flags, integer values, strings, or lists.
Operators: = (set), += (add to list), -= (remove from list), ! (negate).
The basic structure of a user specification is:
who where = (as_whom) what
Components: Runas_Spec (determines user and/or group), Option_Spec (SELinux, dates, timeouts, chdir, chroot), Tag_Spec (EXEC, NOEXEC, LOG_INPUT, etc.).
Tags include: EXEC, NOEXEC, FOLLOW, NOFOLLOW, LOG_INPUT, NOLOG_INPUT, LOG_OUTPUT, NOLOG_OUTPUT, MAIL, NOMAIL, PASSWD, NOPASSWD, SETENV, NOSETENV, INTERCEPT, NOINTERCEPT.
Wildcards: * (any characters), ? (single character), [...] (range), [!...] (not in range), \x (escape).
Including other files: @include and @includedir directives. #include and #includedir are also accepted for compatibility.
Reserved words: ALL, CHROOT, ROLE, TYPE, TIMEOUT, CWD, NOTBEFORE, NOTAFTER. The ! operator can be used for negation.
sudo's behavior can be modified by Default_Entry lines. Supported options are grouped by type:
The sudoers plugin supports its own plugin interface to allow non-Unix group lookups. Group provider plugins are specified via the group_plugin setting. The following plugins are installed by default:
sudoers can log events in either JSON or sudo format. The sudo log format for accepted commands is:
date hostname progname: username : TTY=ttyname ; CHROOT=chroot ; \
PWD=cwd ; USER=runasuser ; GROUP=runasgroup ; TSID=logid ; \
ENV=env_vars COMMAND=command
For denied commands, reasons include "user NOT in sudoers", "command not allowed", "3 incorrect password attempts", etc.
When I/O logging is enabled, sudo runs the command in a pseudo-terminal and logs input/output to the directory specified by iolog_dir (default /var/log/sudo-io). Each log directory contains:
/etc/sudo.conf — Sudo front-end configuration/etc/sudoers — List of who can run what/etc/group — Local groups file/etc/netgroup — List of network groups/var/log/sudo-io — I/O log files/run/sudo/ts — Directory containing time stamps/var/lib/sudo/lectured — Lecture status files/etc/environment — Initial environment for -i mode on AIX and LinuxBelow are example sudoers file entries:
# Run X applications through sudo; HOME is used to find the
# .Xauthority file. Note that other programs use HOME to find
# configuration files and this may lead to privilege escalation!
Defaults env_keep += "DISPLAY HOME"
# User alias specification
User_Alias FULLTIMERS = millert, mikef, dowdy
User_Alias PARTTIMERS = bostley, jwfox, crawl
User_Alias WEBADMIN = will, wendy, wim
# Runas alias specification
Runas_Alias OP = root, operator
Runas_Alias DB = oracle, sybase
Runas_Alias ADMINGRP = adm, oper
# Host alias specification
Host_Alias SPARC = bigtime, eclipse, moet, anchor
Host_Alias SGI = grolsch, dandelion, black
Host_Alias ALPHA = widget, thalamus, foobar
Host_Alias HPPA = boa, nag, python
Host_Alias CUNETS = 128.138.0.0/255.255.0.0
Host_Alias CSNETS = 128.138.243.0, 128.138.204.0/24, 128.138.242.0
Host_Alias SERVERS = primary, mail, www, ns
Host_Alias CDROM = orion, perseus, hercules
# Cmnd alias specification
Cmnd_Alias DUMPS = /usr/bin/mt, /usr/sbin/dump, /usr/sbin/rdump,\
/usr/sbin/restore, /usr/sbin/rrestore,\
sha224:... /home/operator/bin/start_backups
Cmnd_Alias KILL = /usr/bin/kill
Cmnd_Alias PRINTING = /usr/sbin/lpc, /usr/bin/lprm
Cmnd_Alias SHUTDOWN = /usr/sbin/shutdown
Cmnd_Alias HALT = /usr/sbin/halt
Cmnd_Alias REBOOT = /usr/sbin/reboot
Cmnd_Alias SHELLS = /usr/bin/sh, /usr/bin/csh, /usr/bin/ksh,\
/usr/local/bin/tcsh, /usr/bin/rsh,\
/usr/local/bin/zsh
Cmnd_Alias SU = /usr/bin/su
Cmnd_Alias PAGERS = /usr/bin/more, /usr/bin/pg, /usr/bin/less
# Override built-in defaults
Defaults syslog=auth,runcwd=~
Defaults>root !set_logname
Defaults:FULLTIMERS !lecture,runchroot=*
Defaults:millert !authenticate
Defaults@SERVERS log_year, logfile=/var/log/sudo.log
Defaults!PAGERS noexec
# User specifications
root ALL = (ALL) ALL
%wheel ALL = (ALL) ALL
FULLTIMERS ALL = NOPASSWD: ALL
PARTTIMERS ALL = ALL
jack CSNETS = ALL
lisa CUNETS = ALL
operator ALL = DUMPS, KILL, SHUTDOWN, HALT, REBOOT, PRINTING,\
sudoedit /etc/printcap, /usr/oper/bin/
joe ALL = /usr/bin/su operator
pete HPPA = /usr/bin/passwd [A-Za-z]*, !/usr/bin/passwd *root*
%opers ALL = (: ADMINGRP) /usr/sbin/
bob SPARC = (OP) ALL : SGI = (OP) ALL
jim +biglab = ALL
+secretaries ALL = PRINTING, /usr/bin/adduser, /usr/bin/rmuser
fred ALL = (DB) NOPASSWD: ALL
john ALPHA = /usr/bin/su [!-]*, !/usr/bin/su *root*
jen ALL, !SERVERS = ALL
jill SERVERS = /usr/bin/, !SU, !SHELLS
steve CSNETS = (operator) /usr/local/op_commands/
matt valkyrie = KILL
WEBADMIN www = (www) ALL, (root) /usr/bin/su www
ALL CDROM = NOPASSWD: /sbin/umount /CDROM,\
/sbin/mount -o nosuid\,nodev /dev/cd0a /CDROM
It is generally not effective to "subtract" commands from ALL using the '!' operator. A user can trivially circumvent this by copying the desired command to a different name. Therefore, these kind of restrictions should be considered advisory at best.
If fast_glob is in use, it is not possible to reliably negate commands where the path name includes globbing characters, as fnmatch() cannot resolve relative paths.
Four approaches: restrict (avoid giving access to commands that allow shell escapes), intercept (use LD_PRELOAD to intercept exec calls), log (log commands via log_output or log_subcmds), noexec (prevent command from executing other programs).
sudoedit allows users to securely edit files with their own editor. The editor runs with the invoking user's permissions on a temporary copy. Users should never be granted sudoedit permission to edit a file in a directory they have write access to.
sudoers checks ownership and permissions of its time stamp directory. It ignores time stamps set far in the future. On systems with monotonic clock, it uses that to prevent time stamp manipulation.
Versions 1.8.4 and higher support a flexible debugging framework. Configure in sudo.conf with format:
Debug sudoers.so /var/log/sudoers_debug match@info,nss@info
Priorities: crit, err, warn, notice, diag, info, trace, debug. Subsystems: alias, all, audit, auth, defaults, env, ldap, logging, match, netif, nss, parser, perms, plugin, pty, rbtree, sssd, util.
ssh(1), su(1), fnmatch(3), glob(3), mktemp(3), strftime(3), sudo.conf(5), sudo_plugin(5), sudoers.ldap(5), sudoers_timestamp(5), sudo(8), visudo(8)
Many people have worked on sudo over the years; this version consists of code written primarily by Todd C. Miller. See the CONTRIBUTORS file in the sudo distribution (https://www.sudo.ws/contributors.html).
The sudoers file should always be edited by visudo which locks the file and checks for syntax errors. If sudoers contains syntax errors, sudo may refuse to run. When using netgroups of machines, you need to have the machine's host name fully qualified or use the fqdn option.
Submit bug reports at https://bugzilla.sudo.ws/
Limited free support via the sudo-users mailing list: https://www.sudo.ws/mailman/listinfo/sudo-users
sudo is provided "AS IS" and any express or implied warranties are disclaimed. See the LICENSE file distributed with sudo or https://www.sudo.ws/license.html for complete details.
Generated by phpman v4.10.0-7-g98e9fd5 Author: Che Dong Under GNU General Public License
2026-09-07 02:49 @2600:1f28:365:80b0:6da3:f3b7:3cc7:cae0
CrawledBy CCBot/2.0 (https://commoncrawl.org/faq/)