{
    "mode": "man",
    "parameter": "sudoers",
    "section": "5",
    "url": "https://www.chedong.com/phpMan.php/man/sudoers/5/json",
    "generated": "2026-06-13T21:20:00Z",
    "sections": {
        "NAME": {
            "content": "sudoers — default sudo security policy plugin\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "The sudoers policy plugin determines a user's sudo privileges.  It is the default sudo policy\nplugin.  The policy is driven by the /etc/sudoers file or, optionally, in LDAP.  The policy\nformat is described in detail in the SUDOERS FILE FORMAT section.  For information on storing\nsudoers policy information in LDAP, please see sudoers.ldap(5).\n",
            "subsections": [
                {
                    "name": "Configuring sudo.conf for sudoers",
                    "content": "sudo consults the sudo.conf(5) file to determine which plugins to load.  If no sudo.conf(5)\nfile is present, or if it contains no Plugin lines, sudoers will be used for auditing, policy\ndecisions and I/O logging.  To explicitly configure sudo.conf(5) to use the sudoers plugin, the\nfollowing configuration can be used.\n\nPlugin sudoersaudit sudoers.so\nPlugin sudoerspolicy sudoers.so\nPlugin sudoersio sudoers.so\n\nStarting with sudo 1.8.5, it is possible to specify optional arguments to the sudoers plugin in\nthe sudo.conf(5) file.  Plugin arguments, if any, should be listed after the path to the plugin\n(i.e., after sudoers.so).  The arguments are only effective for the plugin that opens (and\nparses) the sudoers file.\n\nFor sudo version 1.9.1 and higher, this is the sudoersaudit plugin.  For older versions, it is\nthe sudoerspolicy plugin.  Multiple arguments may be specified, separated by white space.  For\nexample:\n\nPlugin sudoersaudit sudoers.so sudoersmode=0400 errorrecovery=false\n\nThe following plugin arguments are supported:\n\nerrorrecovery=bool\nThe errorrecovery argument can be used to control whether sudoers should attempt to\nrecover from syntax errors in the sudoers file.  If set to true (the default),\nsudoers will try to recover from a syntax error by discarding the portion of the line\nthat contains the error until the end of the line.  A value of false will disable er‐\nror recovery.  Prior to version 1.9.3, no error recovery was performed.\n\nldapconf=pathname\nThe ldapconf argument can be used to override the default path to the ldap.conf\nfile.\n\nldapsecret=pathname\nThe ldapsecret argument can be used to override the default path to the ldap.secret\nfile.\n\nsudoersfile=pathname\nThe sudoersfile argument can be used to override the default path to the sudoers\nfile.\n\nsudoersuid=user-ID\nThe sudoersuid argument can be used to override the default owner of the sudoers\nfile.  It should be specified as a numeric user-ID.\n\nsudoersgid=group-ID\nThe sudoersgid argument can be used to override the default group of the sudoers\nfile.  It must be specified as a numeric group-ID (not a group name).\n\nsudoersmode=mode\nThe sudoersmode argument can be used to override the default file mode for the sudo‐\ners file.  It should be specified as an octal value.\n\nFor more information on configuring sudo.conf(5), please refer to its manual.\n"
                },
                {
                    "name": "User Authentication",
                    "content": "The sudoers security policy requires that most users authenticate themselves before they can\nuse sudo.  A password is not required if the invoking user is root, if the target user is the\nsame as the invoking user, or if the policy has disabled authentication for the user or com‐\nmand.  Unlike su(1), when sudoers requires authentication, it validates the invoking user's\ncredentials, not the target user's (or root's) credentials.  This can be changed via the\nrootpw, targetpw and runaspw flags, described later.\n\nIf a user who is not listed in the policy tries to run a command via sudo, mail is sent to the\nproper authorities.  The address used for such mail is configurable via the mailto Defaults en‐\ntry (described later) and defaults to root.\n\nNote that no mail will be sent if an unauthorized user tries to run sudo with the -l or -v op‐\ntion unless there is an authentication error and either the mailalways or mailbadpass flags\nare enabled.  This allows users to determine for themselves whether or not they are allowed to\nuse sudo.  By default, all attempts to run sudo (successful or not) are logged, regardless of\nwhether or not mail is sent.\n\nIf sudo is run by root and the SUDOUSER environment variable is set, the sudoers policy will\nuse this value to determine who the actual user is.  This can be used by a user to log commands\nthrough sudo even when a root shell has been invoked.  It also allows the -e option to remain\nuseful even when invoked via a sudo-run script or program.  Note, however, that the sudoers\nfile lookup is still done for root, not the user specified by SUDOUSER.\n\nsudoers uses per-user time stamp files for credential caching.  Once a user has been authenti‐\ncated, a record is written containing the user-ID that was used to authenticate, the terminal\nsession ID, the start time of the session leader (or parent process) and a time stamp (using a\nmonotonic clock if one is available).  The user may then use sudo without a password for a\nshort period of time (15 minutes unless overridden by the timestamptimeout option).  By de‐\nfault, sudoers uses a separate record for each terminal, which means that a user's login ses‐\nsions are authenticated separately.  The timestamptype option can be used to select the type\nof time stamp record sudoers will use.\n"
                },
                {
                    "name": "Logging",
                    "content": "By default, sudoers logs both successful and unsuccessful attempts (as well as errors).  The\nlogallowed and logdenied flags can be used to control this behavior.  Messages can be logged\nto syslog(3), a log file, or both.  The default is to log to syslog(3) but this is configurable\nvia the syslog and logfile settings.  See LOG FORMAT for a description of the log file format.\n\nsudoers is also capable of running a command in a pseudo-terminal and logging all input and/or\noutput.  The standard input, standard output, and standard error can be logged even when not\nassociated with a terminal.  I/O logging is not on by default but can be enabled using the\nloginput and logoutput options as well as the LOGINPUT and LOGOUTPUT command tags.  See I/O\nLOG FILES for details on how I/O log files are stored.\n\nStarting with version 1.9, the logservers setting may be used to send event and I/O log data\nto a remote server running sudologsrvd or another service that implements the protocol de‐\nscribed by sudologsrv.proto(5).\n"
                },
                {
                    "name": "Command environment",
                    "content": "Since environment variables can influence program behavior, sudoers provides a means to re‐\nstrict which variables from the user's environment are inherited by the command to be run.\nThere are two distinct ways sudoers can deal with environment variables.\n\nBy default, the envreset flag is enabled.  This causes commands to be executed with a new,\nminimal environment.  On AIX (and Linux systems without PAM), the environment is initialized\nwith the contents of the /etc/environment file.  The HOME, MAIL, SHELL, LOGNAME and USER envi‐\nronment variables are initialized based on the target user and the SUDO* variables are set\nbased on the invoking user.  Additional variables, such as DISPLAY, PATH and TERM, are pre‐\nserved from the invoking user's environment if permitted by the envcheck, or envkeep options.\nA few environment variables are treated specially.  If the PATH and TERM variables are not pre‐\nserved from the user's environment, they will be set to default values.  The LOGNAME and USER\nare handled as a single entity.  If one of them is preserved (or removed) from the user's envi‐\nronment, the other will be as well.  If LOGNAME and USER are to be preserved but only one of\nthem is present in the user's environment, the other will be set to the same value.  This\navoids an inconsistent environment where one of the variables describing the user name is set\nto the invoking user and one is set to the target user.  Environment variables with a value be‐\nginning with () are removed unless both the name and value parts are matched by envkeep or\nenvcheck, as they may be interpreted as functions by the bash shell.  Prior to version 1.8.11,\nsuch variables were always removed.\n\nIf, however, the envreset flag is disabled, any variables not explicitly denied by the\nenvcheck and envdelete options are allowed and their values are inherited from the invoking\nprocess.  Prior to version 1.8.21, environment variables with a value beginning with () were\nalways removed.  Beginning with version 1.8.21, a pattern in envdelete is used to match bash\nshell functions instead.  Since it is not possible to block all potentially dangerous environ‐\nment variables, use of the default envreset behavior is encouraged.\n\nEnvironment variables specified by envcheck, envdelete, or envkeep may include one or more\n‘*’ characters which will match zero or more characters.  No other wildcard characters are sup‐\nported.\n\nBy default, environment variables are matched by name.  However, if the pattern includes an\nequal sign (‘=’), both the variables name and value must match.  For example, a bash shell\nfunction could be matched as follows:\n\nenvkeep += \"BASHFUNCmyfunc%%=()*\"\n\nWithout the “=()*” suffix, this would not match, as bash shell functions are not preserved by\ndefault.\n\nThe complete list of environment variables that are preserved or removed, as modified by global\nDefaults parameters in sudoers, is displayed when sudo is run by root with the -V option.\nPlease note that the list of environment variables to remove varies based on the operating sys‐\ntem sudo is running on.\n\nOther sudoers options may influence the command environment, such as alwayssethome,\nsecurepath, setlogname, and sethome.\n\nOn systems that support PAM where the pamenv module is enabled for sudo, variables in the PAM\nenvironment may be merged in to the environment.  If a variable in the PAM environment is al‐\nready present in the user's environment, the value will only be overridden if the variable was\nnot preserved by sudoers.  When envreset is enabled, variables preserved from the invoking\nuser's environment by the envkeep list take precedence over those in the PAM environment.\nWhen envreset is disabled, variables present the invoking user's environment take precedence\nover those in the PAM environment unless they match a pattern in the envdelete list.\n\nNote that the dynamic linker on most operating systems will remove variables that can control\ndynamic linking from the environment of set-user-ID executables, including sudo.  Depending on\nthe operating system this may include RLD*, DYLD*, LD*, LDR*, LIBPATH, SHLIBPATH, and oth‐\ners.  These type of variables are removed from the environment before sudo even begins execu‐\ntion and, as such, it is not possible for sudo to preserve them.\n\nAs a special case, if the -i option (initial login) is specified, sudoers will initialize the\nenvironment regardless of the value of envreset.  The DISPLAY, PATH and TERM variables remain\nunchanged; HOME, MAIL, SHELL, USER, and LOGNAME are set based on the target user.  On AIX (and\nLinux systems without PAM), the contents of /etc/environment are also included.  All other en‐\nvironment variables are removed unless permitted by envkeep or envcheck, described above.\n\nFinally, the restrictedenvfile and envfile files are applied, if present.  The variables in\nrestrictedenvfile are applied first and are subject to the same restrictions as the invoking\nuser's environment, as detailed above.  The variables in envfile are applied last and are not\nsubject to these restrictions.  In both cases, variables present in the files will only be set\nto their specified values if they would not conflict with an existing environment variable.\n"
                }
            ]
        },
        "SUDOERS FILE FORMAT": {
            "content": "The sudoers file is composed of two types of entries: aliases (basically variables) and user\nspecifications (which specify who may run what).\n\nWhen multiple entries match for a user, they are applied in order.  Where there are multiple\nmatches, the last match is used (which is not necessarily the most specific match).\n\nThe sudoers file grammar will be described below in Extended Backus-Naur Form (EBNF).  Don't\ndespair if you are unfamiliar with EBNF; it is fairly simple, and the definitions below are an‐\nnotated.\n",
            "subsections": [
                {
                    "name": "Resource limits",
                    "content": "By default, sudoers uses the operating system's native method of setting resource limits for\nthe target user.  On Linux systems, resource limits are usually set by the pamlimits.so PAM\nmodule.  On some BSD systems, the /etc/login.conf file specifies resource limits for the user.\nOn AIX systems, resource limits are configured in the /etc/security/limits file.  If there is\nno system mechanism to set per-user resource limits, the command will run with the same limits\nas the invoking user.  The one exception to this is the core dump file size, which is set by\nsudoers to 0 by default.  Disabling core dumps by default makes it possible to avoid potential\nsecurity problems where the core file is treated as trusted input.\n\nResource limits may also be set in the sudoers file itself, in which case they override those\nset by the system.  See the rlimitas, rlimitcore, rlimitcpu, rlimitdata, rlimitfsize,\nrlimitlocks, rlimitmemlock, rlimitnofile, rlimitnproc, rlimitrss, rlimitstack options de‐\nscribed below.  Resource limits in sudoers may be specified in one of the following formats:\n\n“value”\nBoth the soft and hard resource limits are set to the same value.  The special value\n“infinity” can be used to indicate that the value is unlimited.\n\n“soft,hard”\nTwo comma-separated values.  The soft limit is set to the first value and the hard\nlimit is set to the second.  Both values must either be enclosed in a set of double\nquotes, or the comma must be escaped with a backslash (‘\\’).  The special value\n“infinity” may be used in place of either value.\n\n“default”\nThe default resource limit for the user will be used.  This may be a user-specific\nvalue (see above) or the value of the resource limit when sudo was invoked for systems\nthat don't support per-user limits.\n\n“user”  The invoking user's resource limits will be preserved when running the command.\n\nFor example, to restore the historic core dump file size behavior, a line like the following\nmay be used.\n\nDefaults rlimitcore=default\n\nResource limits in sudoers are only supported by version 1.8.7 or higher.\n"
                },
                {
                    "name": "Quick guide to EBNF",
                    "content": "EBNF is a concise and exact way of describing the grammar of a language.  Each EBNF definition\nis made up of production rules.  E.g.,\n\nsymbol ::= definition | alternate1 | alternate2 ...\n\nEach production rule references others and thus makes up a grammar for the language.  EBNF also\ncontains the following operators, which many readers will recognize from regular expressions.\nDo not, however, confuse them with “wildcard” characters, which have different meanings.\n\n?     Means that the preceding symbol (or group of symbols) is optional.  That is, it may ap‐\npear once or not at all.\n\n*     Means that the preceding symbol (or group of symbols) may appear zero or more times.\n\n+     Means that the preceding symbol (or group of symbols) may appear one or more times.\n\nParentheses may be used to group symbols together.  For clarity, we will use single quotes ('')\nto designate what is a verbatim character string (as opposed to a symbol name).\n"
                },
                {
                    "name": "Aliases",
                    "content": "There are four kinds of aliases: UserAlias, RunasAlias, HostAlias and CmndAlias.  Beginning\nwith sudo 1.9.0, CmdAlias may be used in place of CmndAlias if desired.\n\nAlias ::= 'UserAlias'  UserAliasSpec (':' UserAliasSpec)* |\n'RunasAlias' RunasAliasSpec (':' RunasAliasSpec)* |\n'HostAlias'  HostAliasSpec (':' HostAliasSpec)* |\n'CmndAlias'  CmndAliasSpec (':' CmndAliasSpec)* |\n'CmdAlias'   CmndAliasSpec (':' CmndAliasSpec)*\n\nUserAlias ::= NAME\n\nUserAliasSpec ::= UserAlias '=' UserList\n\nRunasAlias ::= NAME\n\nRunasAliasSpec ::= RunasAlias '=' RunasList\n\nHostAlias ::= NAME\n\nHostAliasSpec ::= HostAlias '=' HostList\n\nCmndAlias ::= NAME\n\nCmndAliasSpec ::= CmndAlias '=' CmndList\n\nNAME ::= [A-Z]([A-Z][0-9])*\n\nEach alias definition is of the form\n\nAliasType NAME = item1, item2, ...\n\nwhere AliasType is one of UserAlias, RunasAlias, HostAlias, or CmndAlias.  A NAME is a\nstring of uppercase letters, numbers, and underscore characters (‘’).  A NAME must start with\nan uppercase letter.  It is possible to put several alias definitions of the same type on a\nsingle line, joined by a colon (‘:’).  E.g.,\n\nAliasType NAME = item1, item2, item3 : NAME = item4, item5\n\nIt is a syntax error to redefine an existing alias.  It is possible to use the same name for\naliases of different types, but this is not recommended.\n\nThe definitions of what constitutes a valid alias member follow.\n\nUserList ::= User |\nUser ',' UserList\n\nUser ::= '!'* user name |\n'!'* #user-ID |\n'!'* %group |\n'!'* %#group-ID |\n'!'* +netgroup |\n'!'* %:nonunixgroup |\n'!'* %:#nonunixgid |\n'!'* UserAlias\n\nA UserList is made up of one or more user names, user-IDs (prefixed with ‘#’), system group\nnames and IDs (prefixed with ‘%’ and ‘%#’ respectively), netgroups (prefixed with ‘+’), non-\nUnix group names and IDs (prefixed with ‘%:’ and ‘%:#’ respectively), and UserAliases. Each\nlist item may be prefixed with zero or more ‘!’ operators.  An odd number of ‘!’ operators\nnegate the value of the item; an even number just cancel each other out.  User netgroups are\nmatched using the user and domain members only; the host member is not used when matching.\n\nA user name, user-ID, group, group-ID, netgroup, nonunixgroup or nonunixgid may be enclosed\nin double quotes to avoid the need for escaping special characters.  Alternately, special char‐\nacters may be specified in escaped hex mode, e.g., \\x20 for space.  When using double quotes,\nany prefix characters must be included inside the quotes.\n\nThe actual nonunixgroup and nonunixgid syntax depends on the underlying group provider\nplugin.  For instance, the QAS AD plugin supports the following formats:\n\n••  Group in the same domain: \"%:Group Name\"\n\n••  Group in any domain: \"%:Group Name@FULLY.QUALIFIED.DOMAIN\"\n\n••  Group SID: \"%:S-1-2-34-5678901234-5678901234-5678901234-567\"\n\nSee GROUP PROVIDER PLUGINS for more information.\n\nNote that quotes around group names are optional.  Unquoted strings must use a backslash (‘\\’)\nto escape spaces and special characters.  See Other special characters and reserved words for a\nlist of characters that need to be escaped.\n\nRunasList ::= RunasMember |\nRunasMember ',' RunasList\n\nRunasMember ::= '!'* user name |\n'!'* #user-ID |\n'!'* %group |\n'!'* %#group-ID |\n'!'* %:nonunixgroup |\n'!'* %:#nonunixgid |\n'!'* +netgroup |\n'!'* RunasAlias\n\nA RunasList is similar to a UserList except that instead of UserAliases it can contain\nRunasAliases.  Note that user names and groups are matched as strings.  In other words, two\nusers (groups) with the same user (group) ID are considered to be distinct.  If you wish to\nmatch all user names with the same user-ID (e.g., root and toor), you can use a user-ID instead\nof a name (#0 in the example given).  Note that the user-ID or group-ID specified in a\nRunasMember need not be listed in the password or group database.\n\nHostList ::= Host |\nHost ',' HostList\n\nHost ::= '!'* host name |\n'!'* ipaddr |\n'!'* network(/netmask)? |\n'!'* +netgroup |\n'!'* HostAlias\n\nA HostList is made up of one or more host names, IP addresses, network numbers, netgroups\n(prefixed with ‘+’), and other aliases.  Again, the value of an item may be negated with the\n‘!’ operator.  Host netgroups are matched using the host (both qualified and unqualified) and\ndomain members only; the user member is not used when matching.  If you specify a network num‐\nber without a netmask, sudo will query each of the local host's network interfaces and, if the\nnetwork number corresponds to one of the hosts's network interfaces, will use the netmask of\nthat interface.  The netmask may be specified either in standard IP address notation (e.g.,\n255.255.255.0 or ffff:ffff:ffff:ffff::), or CIDR notation (number of bits, e.g., 24 or 64).  A\nhost name may include shell-style wildcards (see the Wildcards section below), but unless the\nhost name command on your machine returns the fully qualified host name, you'll need to use the\nfqdn flag for wildcards to be useful.  Note that sudo only inspects actual network interfaces;\nthis means that IP address 127.0.0.1 (localhost) will never match.  Also, the host name\n“localhost” will only match if that is the actual host name, which is usually only the case for\nnon-networked systems.\n\ndigest ::= [A-Fa-f0-9]+ |\n[A-Za-z0-9\\+/=]+\n\nDigestSpec ::= \"sha224\" ':' digest |\n\"sha256\" ':' digest |\n\"sha384\" ':' digest |\n\"sha512\" ':' digest\n\nDigestList ::= DigestSpec |\nDigestSpec ',' DigestList\n\nCmndList ::= Cmnd |\nCmnd ',' CmndList\n\ncommand name ::= file name |\nfile name args |\nfile name '\"\"'\n\nEditSpec ::= \"sudoedit\" file name+\n\nCmnd ::= DigestList? '!'* command name |\n'!'* directory |\n'!'* EditSpec |\n'!'* CmndAlias\n\nA CmndList is a list of one or more command names, directories, and other aliases.  A command\nname is a fully qualified file name which may include shell-style wildcards (see the Wildcards\nsection below).  A simple file name allows the user to run the command with any arguments they\nwish.  However, you may also specify command line arguments (including wildcards).  Alter‐\nnately, you can specify \"\" to indicate that the command may only be run without command line\narguments.  A directory is a fully qualified path name ending in a ‘/’.  When you specify a di‐\nrectory in a CmndList, the user will be able to run any file within that directory (but not in\nany sub-directories therein).\n\nIf a Cmnd has associated command line arguments, then the arguments in the Cmnd must match ex‐\nactly those given by the user on the command line (or match the wildcards if there are any).\nNote that the following characters must be escaped with a ‘\\’ if they are used in command argu‐\nments: ‘,’, ‘:’, ‘=’, ‘\\’.  The built-in command “sudoedit” is used to permit a user to run\nsudo with the -e option (or as sudoedit).  It may take command line arguments just as a normal\ncommand does.  Note that “sudoedit” is a command built into sudo itself and must be specified\nin the sudoers file without a leading path.  If a leading path is present, for example\n/usr/bin/sudoedit, the path name will be silently converted to “sudoedit”.  A fully-qualified\npath for sudoedit is treated as an error by visudo.\n\nA command name may be preceded by a DigestList, a comma-separated list of one or more\nDigestSpec entries.  If a DigestList is present, the command will only match successfully if\nit can be verified using one of the SHA-2 digests in the list.  Starting with version 1.9.0,\nthe ALL reserved word can be used in conjunction with a DigestList.  The following digest for‐\nmats are supported: sha224, sha256, sha384, and sha512.  The string may be specified in either\nhex or base64 format (base64 is more compact).  There are several utilities capable of generat‐\ning SHA-2 digests in hex format such as openssl, shasum, sha224sum, sha256sum, sha384sum,\nsha512sum.\n\nFor example, using openssl:\n\n$ openssl dgst -sha224 /bin/ls\nSHA224(/bin/ls)= 118187da8364d490b4a7debbf483004e8f3e053ec954309de2c41a25\n\nIt is also possible to use openssl to generate base64 output:\n\n$ openssl dgst -binary -sha224 /bin/ls | openssl base64\nEYGH2oNk1JC0p9679IMATo8+BT7JVDCd4sQaJQ==\n\nWarning, if the user has write access to the command itself (directly or via a sudo command),\nit may be possible for the user to replace the command after the digest check has been per‐\nformed but before the command is executed.  A similar race condition exists on systems that\nlack the fexecve() system call when the directory in which the command is located is writable\nby the user.  See the description of the fdexec setting for more information on how sudo exe‐\ncutes commands that have an associated digest.\n\nCommand digests are only supported by version 1.8.7 or higher.\n"
                },
                {
                    "name": "Defaults",
                    "content": "Certain configuration options may be changed from their default values at run-time via one or\nmore DefaultEntry lines.  These may affect all users on any host, all users on a specific\nhost, a specific user, a specific command, or commands being run as a specific user.  Note that\nper-command entries may not include command line arguments.  If you need to specify arguments,\ndefine a CmndAlias and reference that instead.\n\nDefaultType ::= 'Defaults' |\n'Defaults' '@' HostList |\n'Defaults' ':' UserList |\n'Defaults' '!' CmndList |\n'Defaults' '>' RunasList\n\nDefaultEntry ::= DefaultType ParameterList\n\nParameterList ::= Parameter |\nParameter ',' ParameterList\n\nParameter ::= Parameter '=' Value |\nParameter '+=' Value |\nParameter '-=' Value |\n'!'* Parameter\n\nParameters may be flags, integer values, strings, or lists.  Flags are implicitly boolean and\ncan be turned off via the ‘!’ operator.  Some integer, string and list parameters may also be\nused in a boolean context to disable them.  Values may be enclosed in double quotes (\"\") when\nthey contain multiple words.  Special characters may be escaped with a backslash (‘\\’).\n\nTo include a literal backslash character in a command line argument you must escape the back‐\nslash twice.  For example, to match ‘\\n’ as part of a command line argument, you must use\n‘\\\\\\\\n’ in the sudoers file.  This is due to there being two levels of escaping, one in the\nsudoers parser itself and another when command line arguments are matched by the fnmatch(3)\nfunction.\n\nLists have two additional assignment operators, += and -=.  These operators are used to add to\nand delete from a list respectively.  It is not an error to use the -= operator to remove an\nelement that does not exist in a list.\n\nDefaults entries are parsed in the following order: generic, host, user, and runas Defaults\nfirst, then command defaults.  If there are multiple Defaults settings of the same type, the\nlast matching setting is used.  The following Defaults settings are parsed before all others\nsince they may affect subsequent entries: fqdn, groupplugin, runasdefault, sudoerslocale.\n\nSee SUDOERS OPTIONS for a list of supported Defaults parameters.\n"
                },
                {
                    "name": "User specification",
                    "content": "UserSpec ::= UserList HostList '=' CmndSpecList \\\n(':' HostList '=' CmndSpecList)*\n\nCmndSpecList ::= CmndSpec |\nCmndSpec ',' CmndSpecList\n\nCmndSpec ::= RunasSpec? OptionSpec* TagSpec* Cmnd\n\nRunasSpec ::= '(' RunasList? (':' RunasList)? ')'\n\nOptionSpec ::= (SELinuxSpec | DateSpec | TimeoutSpec | ChdirSpec | ChrootSpec)\n\nSELinuxSpec ::= ('ROLE=role' | 'TYPE=type')\n\nDateSpec ::= ('NOTBEFORE=timestamp' | 'NOTAFTER=timestamp')\n\nTimeoutSpec ::= 'TIMEOUT=timeout'\n\nChdirSpec ::= 'CWD=directory'\n\nChrootSpec ::= 'CHROOT=directory'\n\nTagSpec ::= ('EXEC:' | 'NOEXEC:' | 'FOLLOW:' | 'NOFOLLOW' |\n'LOGINPUT:' | 'NOLOGINPUT:' | 'LOGOUTPUT:' |\n'NOLOGOUTPUT:' | 'MAIL:' | 'NOMAIL:' | 'INTERCEPT:' |\n'NOINTERCEPT:' | 'PASSWD:' | 'NOPASSWD:' | 'SETENV:' |\n'NOSETENV:')\n\nA user specification determines which commands a user may run (and as what user) on specified\nhosts.  By default, commands are run as root, but this can be changed on a per-command basis.\n\nThe basic structure of a user specification is “who where = (aswhom) what”.  Let's break that\ndown into its constituent parts:\n\nRunasSpec\nA RunasSpec determines the user and/or the group that a command may be run as.  A fully-speci‐\nfied RunasSpec consists of two RunasLists (as defined above) separated by a colon (‘:’) and\nenclosed in a set of parentheses.  The first RunasList indicates which users the command may\nbe run as via the -u option.  The second defines a list of groups that may be specified via the"
                },
                {
                    "name": "-g",
                    "content": "the command may be run with any combination of users and groups listed in their respective\nRunasLists. If only the first is specified, the command may be run as any user in the list\nand, optionally, with any group the target user belongs to.  If the first RunasList is empty\nbut the second is specified, the command may be run as the invoking user with the group set to\nany listed in the RunasList.  If both RunasLists are empty, the command may only be run as\nthe invoking user and the group, if specified, must be one that the invoking user is a member\nof.  If no RunasSpec is specified, the command may only be run as root and the group, if spec‐\nified, must be one that root is a member of.\n\nA RunasSpec sets the default for the commands that follow it.  What this means is that for the\nentry:\n\ndgb     boulder = (operator) /bin/ls, /bin/kill, /usr/bin/lprm\n\nThe user dgb may run /bin/ls, /bin/kill, and /usr/bin/lprm on the host boulder—but only as\noperator.  E.g.,\n\n$ sudo -u operator /bin/ls\n\nIt is also possible to override a RunasSpec later on in an entry.  If we modify the entry like\nso:\n\ndgb     boulder = (operator) /bin/ls, (root) /bin/kill, /usr/bin/lprm\n\nThen user dgb is now allowed to run /bin/ls as operator, but /bin/kill and /usr/bin/lprm as\nroot.\n\nWe can extend this to allow dgb to run /bin/ls with either the user or group set to operator:\n\ndgb     boulder = (operator : operator) /bin/ls, (root) /bin/kill,\\\n/usr/bin/lprm\n\nNote that while the group portion of the RunasSpec permits the user to run as command with\nthat group, it does not force the user to do so.  If no group is specified on the command line,\nthe command will run with the group listed in the target user's password database entry.  The\nfollowing would all be permitted by the sudoers entry above:\n\n$ sudo -u operator /bin/ls\n$ sudo -u operator -g operator /bin/ls\n$ sudo -g operator /bin/ls\n\nIn the following example, user tcm may run commands that access a modem device file with the\ndialer group.\n\ntcm     boulder = (:dialer) /usr/bin/tip, /usr/bin/cu,\\\n/usr/local/bin/minicom\n\nNote that in this example only the group will be set, the command still runs as user tcm.  E.g.\n\n$ sudo -g dialer /usr/bin/cu\n\nMultiple users and groups may be present in a RunasSpec, in which case the user may select any\ncombination of users and groups via the -u and -g options.  In this example:\n\nalan    ALL = (root, bin : operator, system) ALL\n\nuser alan may run any command as either user root or bin, optionally setting the group to oper‐\nator or system.\n\nOptionSpec\nA Cmnd may have zero or more options associated with it.  Options may consist of SELinux roles\nand/or types, start and/or end dates and command timeouts.  Once an option is set for a Cmnd,\nsubsequent Cmnds in the CmndSpecList, inherit that option unless it is overridden by another\noption.  Note that the option names are reserved words in sudoers.  This means that none of the\nvalid option names (see below) can be used when declaring an alias.\n\nSELinuxSpec\nOn systems with SELinux support, sudoers file entries may optionally have an SELinux role\nand/or type associated with a command.  This can be used to implement a form of role-based ac‐\ncess control (RBAC).  If a role or type is specified with the command it will override any de‐\nfault values specified in sudoers.  A role or type specified on the command line, however, will\nsupersede the values in sudoers.\n\nDateSpec\nsudoers rules can be specified with a start and end date via the NOTBEFORE and NOTAFTER set‐\ntings.  The time stamp must be specified in Generalized Time as defined by RFC 4517.  The for‐\nmat is effectively yyyymmddHHMMSSZ where the minutes and seconds are optional.  The ‘Z’ suffix\nindicates that the time stamp is in Coordinated Universal Time (UTC).  It is also possible to\nspecify a timezone offset from UTC in hours and minutes instead of a ‘Z’.  For example, ‘-0500’\nwould correspond to Eastern Standard time in the US.  As an extension, if no ‘Z’ or timezone\noffset is specified, local time will be used.\n\nThe following are all valid time stamps:\n\n20170214083000Z\n2017021408Z\n20160315220000-0500\n20151201235900\n\nTimeoutSpec\nA command may have a timeout associated with it.  If the timeout expires before the command has\nexited, the command will be terminated.  The timeout may be specified in combinations of days,\nhours, minutes, and seconds with a single-letter case-insensitive suffix that indicates the\nunit of time.  For example, a timeout of 7 days, 8 hours, 30 minutes, and 10 seconds would be\nwritten as 7d8h30m10s.  If a number is specified without a unit, seconds are assumed.  Any of\nthe days, minutes, hours, or seconds may be omitted.  The order must be from largest to small‐\nest unit and a unit may not be specified more than once.\n\nThe following are all valid timeout values: 7d8h30m10s, 14d, 8h30m, 600s, 3600.  The following\nare invalid timeout values: 12m2w1d, 30s10m4h, 1d2d3h.\n\nThis setting is only supported by version 1.8.20 or higher.\n\nChdirSpec\nThe working directory that the command will be run in can be specified using the CWD setting.\nThe directory must be a fully-qualified path name beginning with a ‘/’ or ‘~’ character, or the\nspecial value “*”.  A value of “*” indicates that the user may specify the working directory by\nrunning sudo with the -D option.  By default, commands are run from the invoking user's current\nworking directory, unless the -i option is given.  Path names of the form ~user/path/name are\ninterpreted as being relative to the named user's home directory.  If the user name is omitted,\nthe path will be relative to the runas user's home directory.\n\nThis setting is only supported by version 1.9.3 or higher.\n\nChrootSpec\nThe root directory that the command will be run in can be specified using the CHROOT setting.\nThe directory must be a fully-qualified path name beginning with a ‘/’ or ‘~’ character, or the\nspecial value “*”.  A value of “*” indicates that the user may specify the root directory by\nrunning sudo with the -R option.  This setting can be used to run the command in a chroot(2)\n“sandbox” similar to the chroot(8) utility.  Path names of the form ~user/path/name are inter‐\npreted as being relative to the named user's home directory.  If the user name is omitted, the\npath will be relative to the runas user's home directory.\n\nThis setting is only supported by version 1.9.3 or higher.\n\nTagSpec\nA command may have zero or more tags associated with it.  The following tag values are sup‐\nported: EXEC, NOEXEC, FOLLOW, NOFOLLOW, LOGINPUT, NOLOGINPUT, LOGOUTPUT, NOLOGOUTPUT, MAIL,\nNOMAIL, INTERCEPT, NOINTERCEPT, PASSWD, NOPASSWD, SETENV, and NOSETENV.  Once a tag is set on a\nCmnd, subsequent Cmnds in the CmndSpecList, inherit the tag unless it is overridden by the\nopposite tag (in other words, PASSWD overrides NOPASSWD and NOEXEC overrides EXEC).\n\nEXEC and NOEXEC\n\nIf sudo has been compiled with noexec support and the underlying operating system supports\nit, the NOEXEC tag can be used to prevent a dynamically-linked executable from running fur‐\nther commands itself.\n\nIn the following example, user aaron may run /usr/bin/more and /usr/bin/vi but shell escapes\nwill be disabled.\n\naaron   shanty = NOEXEC: /usr/bin/more, /usr/bin/vi\n\nSee the Preventing shell escapes section below for more details on how NOEXEC works and\nwhether or not it will work on your system.\n\nFOLLOW and NOFOLLOW Starting with version 1.8.15, sudoedit will not open a file that is a sym‐\nbolic link unless the sudoeditfollow flag is enabled.  The FOLLOW and NOFOLLOW tags override\nthe value of sudoeditfollow and can be used to permit (or deny) the editing of symbolic\nlinks on a per-command basis.  These tags are only effective for the sudoedit command and are\nignored for all other commands.\n\nLOGINPUT and NOLOGINPUT\n\nThese tags override the value of the loginput flag on a per-command basis.  For more infor‐\nmation, see the description of loginput in the SUDOERS OPTIONS section below.\n\nLOGOUTPUT and NOLOGOUTPUT\n\nThese tags override the value of the logoutput flag on a per-command basis.  For more infor‐\nmation, see the description of logoutput in the SUDOERS OPTIONS section below.\n\nMAIL and NOMAIL\n\nThese tags provide fine-grained control over whether mail will be sent when a user runs a\ncommand by overriding the value of the mailallcmnds flag on a per-command basis.  They have\nno effect when sudo is run with the -l or -v options.  A NOMAIL tag will also override the\nmailalways and mailnoperms options.  For more information, see the descriptions of\nmailallcmnds, mailalways, and mailnoperms in the SUDOERS OPTIONS section below.\n\nPASSWD and NOPASSWD\n\nBy default, sudo requires that a user authenticate before running a command.  This behavior\ncan be modified via the NOPASSWD tag.  Like a RunasSpec, the NOPASSWD tag sets a default for\nthe commands that follow it in the CmndSpecList.  Conversely, the PASSWD tag can be used to\nreverse things.  For example:\n\nray     rushmore = NOPASSWD: /bin/kill, /bin/ls, /usr/bin/lprm\n\nwould allow the user ray to run /bin/kill, /bin/ls, and /usr/bin/lprm as root on the machine\n“rushmore” without authenticating himself.  If we only want ray to be able to run /bin/kill\nwithout a password the entry would be:\n\nray     rushmore = NOPASSWD: /bin/kill, PASSWD: /bin/ls, /usr/bin/lprm\n\nNote, however, that the PASSWD tag has no effect on users who are in the group specified by\nthe exemptgroup setting.\n\nBy default, if the NOPASSWD tag is applied to any of a user's entries for the current host,\nthe user will be able to run “sudo -l” without a password.  Additionally, a user may only run\n“sudo -v” without a password if all of the user's entries for the current host have the\nNOPASSWD tag.  This behavior may be overridden via the verifypw and listpw options.\n\nSETENV and NOSETENV\n\nThese tags override the value of the setenv flag on a per-command basis.  Note that if SETENV\nhas been set for a command, the user may disable the envreset flag from the command line via\nthe -E option.  Additionally, environment variables set on the command line are not subject\nto the restrictions imposed by envcheck, envdelete, or envkeep.  As such, only trusted\nusers should be allowed to set variables in this manner.  If the command matched is ALL, the\nSETENV tag is implied for that command; this default may be overridden by use of the NOSETENV\ntag.\n\nINTERCEPT and NOINTERCEPT\n\nIf sudo has been compiled with intercept support and the underlying operating system supports\nit, the INTERCEPT tag can be used to cause programs spawned by a command to be validated\nagainst sudoers and logged just like they would be if run through sudo directly.  This is\nuseful in conjunction with commands that allow shell escapes such as editors, shells, and\npaginators.\n\nIn the following example, user chuck may run any command on the machine “research” in inter‐\ncept mode.\n\nchuck   research = INTERCEPT: ALL\n\nSee the Preventing shell escapes section below for more details on how INTERCEPT works and\nwhether or not it will work on your system.\n",
                    "flag": "-g"
                },
                {
                    "name": "Wildcards",
                    "content": "sudo allows shell-style wildcards (aka meta or glob characters) to be used in host names, path\nnames, and command line arguments in the sudoers file.  Wildcard matching is done via the\nglob(3) and fnmatch(3) functions as specified by IEEE Std 1003.1 (“POSIX.1”).\n\n*         Matches any set of zero or more characters (including white space).\n\n?         Matches any single character (including white space).\n\n[...]     Matches any character in the specified range.\n\n[!...]    Matches any character not in the specified range.\n\n\\x        For any character ‘x’, evaluates to ‘x’.  This is used to escape special characters\nsuch as: ‘*’, ‘?’, ‘[’, and ‘]’.\n\nNote that these are not regular expressions.  Unlike a regular expression there is no way to\nmatch one or more characters within a range.\n\nCharacter classes may be used if your system's glob(3) and fnmatch(3) functions support them.\nHowever, because the ‘:’ character has special meaning in sudoers, it must be escaped.  For ex‐\nample:\n\n/bin/ls [[\\:alpha\\:]]*\n\nWould match any file name beginning with a letter.\n\nNote that a forward slash (‘/’) will not be matched by wildcards used in the file name portion\nof the command.  This is to make a path like:\n\n/usr/bin/*\n\nmatch /usr/bin/who but not /usr/bin/X11/xterm.\n\nWhen matching the command line arguments, however, a slash does get matched by wildcards since\ncommand line arguments may contain arbitrary strings and not just path names.\n"
                },
                {
                    "name": "Wildcards in command line arguments should be used with care.",
                    "content": "Command line arguments are matched as a single, concatenated string.  This mean a wildcard\ncharacter such as ‘?’ or ‘*’ will match across word boundaries, which may be unexpected.  For\nexample, while a sudoers entry like:\n\n%operator ALL = /bin/cat /var/log/messages*\n\nwill allow command like:\n\n$ sudo cat /var/log/messages.1\n\nIt will also allow:\n\n$ sudo cat /var/log/messages /etc/shadow\n\nwhich is probably not what was intended.  In most cases it is better to do command line pro‐\ncessing outside of the sudoers file in a scripting language.\n"
                },
                {
                    "name": "Exceptions to wildcard rules",
                    "content": "The following exceptions apply to the above rules:\n\n\"\"        If the empty string \"\" is the only command line argument in the sudoers file entry it\nmeans that command is not allowed to be run with any arguments.\n\nsudoedit  Command line arguments to the sudoedit built-in command should always be path names,\nso a forward slash (‘/’) will not be matched by a wildcard.\n"
                },
                {
                    "name": "Including other files from within sudoers",
                    "content": "It is possible to include other sudoers files from within the sudoers file currently being\nparsed using the @include and @includedir directives.  For compatibility with sudo versions\nprior to 1.9.1, #include and #includedir are also accepted.\n\nAn include file can be used, for example, to keep a site-wide sudoers file in addition to a lo‐\ncal, per-machine file.  For the sake of this example the site-wide sudoers file will be\n/etc/sudoers and the per-machine one will be /etc/sudoers.local.  To include /etc/sudoers.local\nfrom within /etc/sudoers one would use the following line in /etc/sudoers:\n\n@include /etc/sudoers.local\n\nWhen sudo reaches this line it will suspend processing of the current file (/etc/sudoers) and\nswitch to /etc/sudoers.local.  Upon reaching the end of /etc/sudoers.local, the rest of\n/etc/sudoers will be processed.  Files that are included may themselves include other files.  A\nhard limit of 128 nested include files is enforced to prevent include file loops.\n\nStarting with version 1.9.1, the path to the include file may contain white space if it is es‐\ncaped with a backslash (‘\\’).  Alternately, the entire path may be enclosed in double quotes\n(\"\"), in which case no escaping is necessary.  To include a literal backslash in the path, ‘\\\\’\nshould be used.\n\nIf the path to the include file is not fully-qualified (does not begin with a ‘/’), it must be\nlocated in the same directory as the sudoers file it was included from.  For example, if\n/etc/sudoers contains the line:\n\n@include sudoers.local\n\nthe file that will be included is /etc/sudoers.local.\n\nThe file name may also include the %h escape, signifying the short form of the host name.  In\nother words, if the machine's host name is “xerxes”, then\n\n@include /etc/sudoers.%h\n\nwill cause sudo to include the file /etc/sudoers.xerxes.\n\nThe @includedir directive can be used to create a sudoers.d directory that the system package\nmanager can drop sudoers file rules into as part of package installation.  For example, given:\n\n@includedir /etc/sudoers.d\n\nsudo will suspend processing of the current file and read each file in /etc/sudoers.d, skipping\nfile names that end in ‘~’ or contain a ‘.’ character to avoid causing problems with package\nmanager or editor temporary/backup files.  Files are parsed in sorted lexical order.  That is,\n/etc/sudoers.d/01first will be parsed before /etc/sudoers.d/10second.  Be aware that because\nthe sorting is lexical, not numeric, /etc/sudoers.d/1whoops would be loaded after\n/etc/sudoers.d/10second.  Using a consistent number of leading zeroes in the file names can be\nused to avoid such problems.  After parsing the files in the directory, control returns to the\nfile that contained the @includedir directive.\n\nNote that unlike files included via @include, visudo will not edit the files in a @includedir\ndirectory unless one of them contains a syntax error.  It is still possible to run visudo with\nthe -f flag to edit the files directly, but this will not catch the redefinition of an alias\nthat is also present in a different file.\n"
                },
                {
                    "name": "Other special characters and reserved words",
                    "content": "The pound sign (‘#’) is used to indicate a comment (unless it is part of a #include directive\nor unless it occurs in the context of a user name and is followed by one or more digits, in\nwhich case it is treated as a user-ID).  Both the comment character and any text after it, up\nto the end of the line, are ignored.\n\nThe reserved word ALL is a built-in alias that always causes a match to succeed.  It can be\nused wherever one might otherwise use a CmndAlias, UserAlias, RunasAlias, or HostAlias.\nAttempting to define an alias named ALL will result in a syntax error.  Please note that using\nALL can be dangerous since in a command context, it allows the user to run any command on the\nsystem.\n\nThe following option names permitted in an OptionSpec are also considered reserved words:\nCHROOT, ROLE, TYPE, TIMEOUT, CWD, NOTBEFORE and NOTAFTER.  Attempting to define an alias with\nthe same name as one of the options will result in a syntax error.\n\nAn exclamation point (‘!’) can be used as a logical not operator in a list or alias as well as\nin front of a Cmnd.  This allows one to exclude certain values.  For the ‘!’ operator to be ef‐\nfective, there must be something for it to exclude.  For example, to match all users except for\nroot one would use:\n\nALL,!root\n\nIf the ALL, is omitted, as in:\n\n!root\n\nit would explicitly deny root but not match any other users.  This is different from a true\n“negation” operator.\n\nNote, however, that using a ‘!’ in conjunction with the built-in ALL alias to allow a user to\nrun “all but a few” commands rarely works as intended (see SECURITY NOTES below).\n\nLong lines can be continued with a backslash (‘\\’) as the last character on the line.\n\nWhite space between elements in a list as well as special syntactic characters in a User\nSpecification (‘=’, ‘:’, ‘(’, ‘)’) is optional.\n\nThe following characters must be escaped with a backslash (‘\\’) when used as part of a word\n(e.g., a user name or host name): ‘!’, ‘=’, ‘:’, ‘,’, ‘(’, ‘)’, ‘\\’.\n"
                }
            ]
        },
        "SUDOERS OPTIONS": {
            "content": "sudo's behavior can be modified by DefaultEntry lines, as explained earlier.  A list of all\nsupported Defaults parameters, grouped by type, are listed below.\n\nBoolean Flags:\n\nalwaysquerygroupplugin\nIf a groupplugin is configured, use it to resolve groups of the form %group\nas long as there is not also a system group of the same name.  Normally, only\ngroups of the form %:group are passed to the groupplugin.  This flag is off\nby default.\n\nalwayssethome   If enabled, sudo will set the HOME environment variable to the home directory\nof the target user (which is the root user unless the -u option is used).\nThis flag is largely obsolete and has no effect unless the envreset flag has\nbeen disabled or HOME is present in the envkeep list, both of which are\nstrongly discouraged.  This flag is off by default.\n\nauthenticate      If set, users must authenticate themselves via a password (or other means of\nauthentication) before they may run commands.  This default may be overridden\nvia the PASSWD and NOPASSWD tags.  This flag is on by default.\n\ncaseinsensitivegroup\nIf enabled, group names in sudoers will be matched in a case insensitive man‐\nner.  This may be necessary when users are stored in LDAP or AD.  This flag\nis on by default.\n\ncaseinsensitiveuser\nIf enabled, user names in sudoers will be matched in a case insensitive man‐\nner.  This may be necessary when groups are stored in LDAP or AD.  This flag\nis on by default.\n\nclosefromoverride\nIf set, the user may use the -C option which overrides the default starting\npoint at which sudo begins closing open file descriptors.  This flag is off\nby default.\n\ncompressio       If set, and sudo is configured to log a command's input or output, the I/O\nlogs will be compressed using zlib.  This flag is on by default when sudo is\ncompiled with zlib support.\n\nexecbackground   By default, sudo runs a command as the foreground process as long as sudo it‐\nself is running in the foreground.  When the execbackground flag is enabled\nand the command is being run in a pseudo-terminal (due to I/O logging or the\nusepty flag), the command will be run as a background process.  Attempts to\nread from the controlling terminal (or to change terminal settings) will re‐\nsult in the command being suspended with the SIGTTIN signal (or SIGTTOU in\nthe case of terminal settings).  If this happens when sudo is a foreground\nprocess, the command will be granted the controlling terminal and resumed in\nthe foreground with no user intervention required.  The advantage of ini‐\ntially running the command in the background is that sudo need not read from\nthe terminal unless the command explicitly requests it.  Otherwise, any ter‐\nminal input must be passed to the command, whether it has required it or not\n(the kernel buffers terminals so it is not possible to tell whether the com‐\nmand really wants the input).  This is different from historic sudo behavior\nor when the command is not being run in a pseudo-terminal.\n\nFor this to work seamlessly, the operating system must support the automatic\nrestarting of system calls.  Unfortunately, not all operating systems do this\nby default, and even those that do may have bugs.  For example, macOS fails\nto restart the tcgetattr() and tcsetattr() system calls (this is a bug in\nmacOS).  Furthermore, because this behavior depends on the command stopping\nwith the SIGTTIN or SIGTTOU signals, programs that catch these signals and\nsuspend themselves with a different signal (usually SIGTOP) will not be auto‐\nmatically foregrounded.  Some versions of the linux su(1) command behave this\nway.  This flag is off by default.\n\nThis setting is only supported by version 1.8.7 or higher.  It has no effect\nunless I/O logging is enabled or the usepty flag is enabled.\n\nenveditor        If set, visudo will use the value of the SUDOEDITOR, VISUAL or EDITOR envi‐\nronment variables before falling back on the default editor list.  Note that\nvisudo is typically run as root so this flag may allow a user with visudo\nprivileges to run arbitrary commands as root without logging.  An alternative\nis to place a colon-separated list of “safe” editors int the editor setting.\nvisudo will then only use SUDOEDITOR, VISUAL or EDITOR if they match a value\nspecified in editor.  If the envreset flag is enabled, the SUDOEDITOR,\nVISUAL and/or EDITOR environment variables must be present in the envkeep\nlist for the enveditor flag to function when visudo is invoked via sudo.\nThis flag is on by default.\n\nenvreset         If set, sudo will run the command in a minimal environment containing the\nTERM, PATH, HOME, MAIL, SHELL, LOGNAME, USER and SUDO* variables.  Any vari‐\nables in the caller's environment or in the file specified by the\nrestrictedenvfile setting that match the envkeep and envcheck lists are\nthen added, followed by any variables present in the file specified by the\nenvfile setting (if any).  The contents of the envkeep and envcheck lists,\nas modified by global Defaults parameters in sudoers, are displayed when sudo\nis run by root with the -V option.  If the securepath setting is enabled,\nits value will be used for the PATH environment variable.  This flag is on by\ndefault.\n\nfastglob         Normally, sudo uses the glob(3) function to do shell-style globbing when\nmatching path names.  However, since it accesses the file system, glob(3) can\ntake a long time to complete for some patterns, especially when the pattern\nreferences a network file system that is mounted on demand (auto mounted).\nThe fastglob flag causes sudo to use the fnmatch(3) function, which does not\naccess the file system to do its matching.  The disadvantage of fastglob is\nthat it is unable to match relative path names such as ./ls or ../bin/ls.\nThis has security implications when path names that include globbing charac‐\nters are used with the negation operator, ‘!’, as such rules can be trivially\nbypassed.  As such, this flag should not be used when the sudoers file con‐\ntains rules that contain negated path names which include globbing charac‐\nters.  This flag is off by default.\n\nfqdn              Set this flag if you want to put fully qualified host names in the sudoers\nfile when the local host name (as returned by the hostname command) does not\ncontain the domain name.  In other words, instead of myhost you would use my‐\nhost.mydomain.edu.  You may still use the short form if you wish (and even\nmix the two).  This flag is only effective when the “canonical” host name, as\nreturned by the getaddrinfo() or gethostbyname() function, is a fully-quali‐\nfied domain name.  This is usually the case when the system is configured to\nuse DNS for host name resolution.\n\nIf the system is configured to use the /etc/hosts file in preference to DNS,\nthe “canonical” host name may not be fully-qualified.  The order that sources\nare queried for host name resolution is usually specified in the\n/etc/nsswitch.conf, /etc/netsvc.conf, /etc/host.conf, or, in some cases,\n/etc/resolv.conf file.  In the /etc/hosts file, the first host name of the\nentry is considered to be the “canonical” name; subsequent names are aliases\nthat are not used by sudoers.  For example, the following hosts file line for\nthe machine “xyzzy” has the fully-qualified domain name as the “canonical”\nhost name, and the short version as an alias.\n\n192.168.1.1 xyzzy.sudo.ws xyzzy\n\nIf the machine's hosts file entry is not formatted properly, the fqdn flag\nwill not be effective if it is queried before DNS.\n\nBeware that when using DNS for host name resolution, turning on fqdn requires\nsudoers to make DNS lookups which renders sudo unusable if DNS stops working\n(for example if the machine is disconnected from the network).  Also note\nthat just like with the hosts file, you must use the “canonical” name as DNS\nknows it.  That is, you may not use a host alias (CNAME entry) due to perfor‐\nmance issues and the fact that there is no way to get all aliases from DNS.\n\nThis flag is on by default.\n\nignoreauditerrors\nAllow commands to be run even if sudoers cannot write to the audit log.  If\nenabled, an audit log write failure is not treated as a fatal error.  If dis‐\nabled, a command may only be run after the audit event is successfully writ‐\nten.  This flag is only effective on systems for which sudoers supports audit\nlogging, including FreeBSD, Linux, macOS, and Solaris.  This flag is on by\ndefault.\n\nignoredot        If set, sudo will ignore \".\" or \"\" (both denoting current directory) in the\nPATH environment variable; the PATH itself is not modified.  This flag is off\nby default.\n\nignoreiologerrors\nAllow commands to be run even if sudoers cannot write to the I/O log (local\nor remote).  If enabled, an I/O log write failure is not treated as a fatal\nerror.  If disabled, the command will be terminated if the I/O log cannot be\nwritten to.  This flag is off by default.\n\nignorelogfileerrors\nAllow commands to be run even if sudoers cannot write to the log file.  If\nenabled, a log file write failure is not treated as a fatal error.  If dis‐\nabled, a command may only be run after the log file entry is successfully\nwritten.  This flag only has an effect when sudoers is configured to use\nfile-based logging via the logfile setting.  This flag is on by default.\n\nignorelocalsudoers\nIf set via LDAP, parsing of /etc/sudoers will be skipped.  This is intended\nfor Enterprises that wish to prevent the usage of local sudoers files so that\nonly LDAP is used.  This thwarts the efforts of rogue operators who would at‐\ntempt to add roles to /etc/sudoers.  When this flag is enabled, /etc/sudoers\ndoes not even need to exist.  Since this flag tells sudo how to behave when\nno specific LDAP entries have been matched, this sudoOption is only meaning‐\nful for the cn=defaults section.  This flag is off by default.\n\nignoreunknowndefaults\nIf set, sudo will not produce a warning if it encounters an unknown Defaults\nentry in the sudoers file or an unknown sudoOption in LDAP.  This flag is off\nby default.\n\ninsults           If set, sudo will insult users when they enter an incorrect password.  This\nflag is off by default.\n\nlogallowed       If set, sudoers will log commands allowed by the policy to the system audit\nlog (where supported) as well as to syslog and/or a log file.  This flag is\non by default.\n\nThis setting is only supported by version 1.8.29 or higher.\n\nlogdenied        If set, sudoers will log commands denied by the policy to the system audit\nlog (where supported) as well as to syslog and/or a log file.  This flag is\non by default.\n\nThis setting is only supported by version 1.8.29 or higher.\n\nlogexitstatus   If set, sudoers will log the exit value of commands that are run to syslog\nand/or a log file.  If a command was terminated by a signal, the signal name\nis logged as well.  This flag is off by default.\n\nThis setting is only supported by version 1.9.8 or higher.\n\nloghost          If set, the host name will be included in log entries written to the file\nconfigured by the logfile setting.  This flag is off by default.\n\nloginput         If set, sudo will run the command in a pseudo-terminal and log all user in‐\nput.  If the standard input is not connected to the user's tty, due to I/O\nredirection or because the command is part of a pipeline, that input is also\ncaptured and stored in a separate log file.  Anything sent to the standard\ninput will be consumed, regardless of whether or not the command run via sudo\nis actually reading the standard input.  This may have unexpected results\nwhen using sudo in a shell script that expects to process the standard input.\nFor more information about I/O logging, see the I/O LOG FILES section.  This\nflag is off by default.\n\nlogoutput        If set, sudo will run the command in a pseudo-terminal and log all output\nthat is sent to the screen, similar to the script(1) command.  For more in‐\nformation about I/O logging, see the I/O LOG FILES section.  This flag is off\nby default.\n\nlogserverkeepalive\nIf set, sudo will enable the TCP keepalive socket option on the connection to\nthe log server.  This enables the periodic transmission of keepalive messages\nto the server.  If the server does not respond to a message, the connection\nwill be closed and the running command will be terminated unless the\nignoreiologerrors flag (I/O logging enabled) or the ignorelogerrors flag\n(I/O logging disabled) is set.  This flag is on by default.\n\nThis setting is only supported by version 1.9.0 or higher.\n\nlogserververify\nIf set, the server certificate received during the TLS handshake must be\nvalid and it must contain either the server name (from logservers) or its IP\naddress.  If either of these conditions is not met, the TLS handshake will\nfail.  This flag is on by default.\n\nThis setting is only supported by version 1.9.0 or higher.\n\nlogsubcmds       If set, sudoers will log when a command spawns a child process and executes a\nprogram using the execl(), execle(), execlp(), execv(), execve(), execvp(),\nor execvpe() library functions.  For example, if a shell is run by sudo, the\nindividual commands run via the shell will be logged.  This flag is off by\ndefault.\n\nThe logsubcmds flag uses the same underlying mechanism as the intercept set‐\nting.  See Preventing shell escapes for more information on what systems sup‐\nport this option and its limitations.  This setting is only supported by ver‐\nsion 1.9.8 or higher and is incompatible with SELinux RBAC support.\n\nlogyear          If set, the four-digit year will be logged in the (non-syslog) sudo log file.\nThis flag is off by default.\n\nlongotpprompt   When validating with a One Time Password (OTP) scheme such as S/Key or OPIE,\na two-line prompt is used to make it easier to cut and paste the challenge to\na local window.  It's not as pretty as the default but some people find it\nmore convenient.  This flag is off by default.\n\nmailallcmnds    Send mail to the mailto user every time a user attempts to run a command via\nsudo (this includes sudoedit).  No mail will be sent if the user runs sudo\nwith the -l or -v option unless there is an authentication error and the\nmailbadpass flag is also set.  This flag is off by default.\n\nmailalways       Send mail to the mailto user every time a user runs sudo.  This flag is off\nby default.\n\nmailbadpass      Send mail to the mailto user if the user running sudo does not enter the cor‐\nrect password.  If the command the user is attempting to run is not permitted\nby sudoers and one of the mailallcmnds, mailalways, mailnohost,\nmailnoperms or mailnouser flags are set, this flag will have no effect.\nThis flag is off by default.\n\nmailnohost      If set, mail will be sent to the mailto user if the invoking user exists in\nthe sudoers file, but is not allowed to run commands on the current host.\nThis flag is off by default.\n\nmailnoperms     If set, mail will be sent to the mailto user if the invoking user is allowed\nto use sudo but the command they are trying is not listed in their sudoers\nfile entry or is explicitly denied.  This flag is off by default.\n\nmailnouser      If set, mail will be sent to the mailto user if the invoking user is not in\nthe sudoers file.  This flag is on by default.\n\nmatchgroupbygid\nBy default, sudoers will look up each group the user is a member of by group-\nID to determine the group name (this is only done once).  The resulting list\nof the user's group names is used when matching groups listed in the sudoers\nfile.  This works well on systems where the number of groups listed in the\nsudoers file is larger than the number of groups a typical user belongs to.\nOn systems where group lookups are slow, where users may belong to a large\nnumber of groups, and where the number of groups listed in the sudoers file\nis relatively small, it may be prohibitively expensive and running commands\nvia sudo may take longer than normal.  On such systems it may be faster to\nuse the matchgroupbygid flag to avoid resolving the user's group-IDs to\ngroup names.  In this case, sudoers must look up any group name listed in the\nsudoers file and use the group-ID instead of the group name when determining\nwhether the user is a member of the group.\n\nNote that if matchgroupbygid is enabled, group database lookups performed\nby sudoers will be keyed by group name as opposed to group-ID.  On systems\nwhere there are multiple sources for the group database, it is possible to\nhave conflicting group names or group-IDs in the local /etc/group file and\nthe remote group database.  On such systems, enabling or disabling\nmatchgroupbygid can be used to choose whether group database queries are\nperformed by name (enabled) or ID (disabled), which may aid in working around\ngroup entry conflicts.\n\nThe matchgroupbygid flag has no effect when sudoers data is stored in\nLDAP.  This flag is off by default.\n\nThis setting is only supported by version 1.8.18 or higher.\n\nintercept         If set, all commands run via sudo will behave as if the INTERCEPT tag has\nbeen set, unless overridden by an NOINTERCEPT tag.  See the description of\nINTERCEPT and NOINTERCEPT above as well as the Preventing shell escapes sec‐\ntion at the end of this manual.  This flag is off by default.\n\nThis setting is only supported by version 1.9.8 or higher and is incompatible\nwith SELinux RBAC support.\n\ninterceptallowsetid\nOn most systems, the dynamic loader will ignore LDPRELOAD (or the equiva‐\nlent) when running set-user-ID and set-group-ID programs, effectively dis‐\nabling intercept mode.  To prevent this from happening, sudoers will not per‐\nmit a set-user-ID or set-group-ID program to be run in intercept mode unless\ninterceptallowsetid is set.  This flag has no effect unless the intercept\nflag is enabled or the INTERCEPT tag has been set for the command.  This flag\nis on by default.\n\nThis setting is only supported by version 1.9.8 or higher.\n\ninterceptauthenticate\nIf set, commands run by an intercepted process must be authenticated when the\nuser's time stamp is not current.  For example, if a shell is run with\nintercept enabled, as soon as the invoking user's time stamp is out of date,\nsubsequent commands will need to be authenticated.  This flag has no effect\nunless the intercept flag is enabled or the INTERCEPT tag has been set for\nthe command.  This flag is off by default.\n\nThis setting is only supported by version 1.9.8 or higher.\n\nnetgrouptuple    If set, netgroup lookups will be performed using the full netgroup tuple:\nhost name, user name, and domain (if one is set).  Historically, sudo only\nmatched the user name and domain for netgroups used in a UserList and only\nmatched the host name and domain for netgroups used in a HostList.  This\nflag is off by default.\n\nnoexec            If set, all commands run via sudo will behave as if the NOEXEC tag has been\nset, unless overridden by an EXEC tag.  See the description of EXEC and\nNOEXEC above as well as the Preventing shell escapes section at the end of\nthis manual.  This flag is off by default.\n\npamacctmgmt     On systems that use PAM for authentication, sudo will perform PAM account\nvalidation for the invoking user by default.  The actual checks performed de‐\npend on which PAM modules are configured.  If enabled, account validation\nwill be performed regardless of whether or not a password is required.  This\nflag is on by default.\n\nThis setting is only supported by version 1.8.28 or higher.\n\npamrhost         On systems that use PAM for authentication, sudo will set the PAM remote host\nvalue to the name of the local host when the pamrhost flag is enabled.  On\nLinux systems, enabling pamrhost may result in DNS lookups of the local host\nname when PAM is initialized.  On Solaris versions prior to Solaris 8,\npamrhost must be enabled if pamruser is also enabled to avoid a crash in\nthe Solaris PAM implementation.\n\nThis flag is off by default on systems other than Solaris.\n\nThis setting is only supported by version 1.9.0 or higher.\n\npamruser         On systems that use PAM for authentication, sudo will set the PAM remote user\nvalue to the name of the user that invoked sudo when the pamruser flag is\nenabled.  This flag is on by default.\n\nThis setting is only supported by version 1.9.0 or higher.\n\npamsession       On systems that use PAM for authentication, sudo will create a new PAM ses‐\nsion for the command to be run in.  Unless sudo is given the -i or -s op‐\ntions, PAM session modules are run with the “silent” flag enabled.  This pre‐\nvents last login information from being displayed for every command on some\nsystems.  Disabling pamsession may be needed on older PAM implementations or\non operating systems where opening a PAM session changes the utmp or wtmp\nfiles.  If PAM session support is disabled, resource limits may not be up‐\ndated for the command being run.  If pamsession, pamsetcred, and usepty\nare disabled, logservers has not been set and I/O logging has not been con‐\nfigured, sudo will execute the command directly instead of running it as a\nchild process.  This flag is on by default.\n\nThis setting is only supported by version 1.8.7 or higher.\n\npamsetcred       On systems that use PAM for authentication, sudo will attempt to establish\ncredentials for the target user by default, if supported by the underlying\nauthentication system.  One example of a credential is a Kerberos ticket.  If\npamsession, pamsetcred, and usepty are disabled, logservers has not been\nset and I/O logging has not been configured, sudo will execute the command\ndirectly instead of running it as a child process.  This flag is on by de‐\nfault.\n\nThis setting is only supported by version 1.8.8 or higher.\n\npasspromptoverride\nIf set, the prompt specified by passprompt or the SUDOPROMPT environment\nvariable will always be used and will replace the prompt provided by a PAM\nmodule or other authentication method.  This flag is off by default.\n\npathinfo         Normally, sudo will tell the user when a command could not be found in their\nPATH environment variable.  Some sites may wish to disable this as it could\nbe used to gather information on the location of executables that the normal\nuser does not have access to.  The disadvantage is that if the executable is\nsimply not in the user's PATH, sudo will tell the user that they are not al‐\nlowed to run it, which can be confusing.  This flag is on by default.\n\npreservegroups   By default, sudo will initialize the group vector to the list of groups the\ntarget user is in.  When preservegroups is set, the user's existing group\nvector is left unaltered.  The real and effective group-IDs, however, are\nstill set to match the target user.  This flag is off by default.\n\npwfeedback        By default, sudo reads the password like most other Unix programs, by turning\noff echo until the user hits the return (or enter) key.  Some users become\nconfused by this as it appears to them that sudo has hung at this point.\nWhen pwfeedback is set, sudo will provide visual feedback when the user\npresses a key.  Note that this does have a security impact as an onlooker may\nbe able to determine the length of the password being entered.  This flag is\noff by default.\n\nrequiretty        If set, sudo will only run when the user is logged in to a real tty.  When\nthis flag is set, sudo can only be run from a login session and not via other\nmeans such as cron(8) or cgi-bin scripts.  This flag is off by default.\n\nrootsudo         If set, root is allowed to run sudo too.  Disabling this prevents users from\n“chaining” sudo commands to get a root shell by doing something like “sudo\nsudo /bin/sh”.  Note, however, that turning off rootsudo will also prevent\nroot from running sudoedit.  Disabling rootsudo provides no real additional\nsecurity; it exists purely for historical reasons.  This flag is on by de‐\nfault.\n\nrootpw            If set, sudo will prompt for the root password instead of the password of the\ninvoking user when running a command or editing a file.  This flag is off by\ndefault.\n\nrunasallowunknownid\nIf enabled, allow matching of runas user and group IDs that are not present\nin the password or group databases.  In addition to explicitly matching un‐\nknown user or group IDs in a RunasList, this option also allows the ALL\nalias to match unknown IDs.  This flag is off by default.\n\nThis setting is only supported by version 1.8.30 or higher.  Older versions\nof sudo always allowed matching of unknown user and group IDs.\n\nrunascheckshell\nIf enabled, sudo will only run commands as a user whose shell appears in the\n/etc/shells file, even if the invoking user's RunasList would otherwise per‐\nmit it.  If no /etc/shells file is present, a system-dependent list of built-\nin default shells is used.  On many operating systems, system users such as\n“bin”, do not have a valid shell and this flag can be used to prevent com‐\nmands from being run as those users.  This flag is off by default.\n\nThis setting is only supported by version 1.8.30 or higher.\n\nrunaspw           If set, sudo will prompt for the password of the user defined by the\nrunasdefault option (defaults to root) instead of the password of the invok‐\ning user when running a command or editing a file.  This flag is off by de‐\nfault.\n\nselinux           If enabled, the user may specify an SELinux role and/or type to use when run‐\nning the command, as permitted by the SELinux policy.  If SELinux is disabled\non the system, this flag has no effect.  This flag is on by default.\n\nsethome          If enabled and sudo is invoked with the -s option, the HOME environment vari‐\nable will be set to the home directory of the target user (which is the root\nuser unless the -u option is used).  This flag is largely obsolete and has no\neffect unless the envreset flag has been disabled or HOME is present in the\nenvkeep list, both of which are strongly discouraged.  This flag is off by\ndefault.\n\nsetlogname       Normally, sudo will set the LOGNAME and USER environment variables to the\nname of the target user (usually root unless the -u option is given).  How‐\never, since some programs (including the RCS revision control system) use\nLOGNAME to determine the real identity of the user, it may be desirable to\nchange this behavior.  This can be done by negating the setlogname option.\nNote that setlogname will have no effect if the envreset option has not\nbeen disabled and the envkeep list contains LOGNAME or USER.  This flag is\non by default.\n\nsetutmp          When enabled, sudo will create an entry in the utmp (or utmpx) file when a\npseudo-terminal is allocated.  A pseudo-terminal is allocated by sudo when it\nis running in a terminal and one or more of the loginput, logoutput, or\nusepty flags is enabled.  By default, the new entry will be a copy of the\nuser's existing utmp entry (if any), with the tty, time, type, and pid fields\nupdated.  This flag is on by default.\n\nsetenv            Allow the user to disable the envreset option from the command line via the\n-E option.  Additionally, environment variables set via the command line are\nnot subject to the restrictions imposed by envcheck, envdelete, or\nenvkeep.  As such, only trusted users should be allowed to set variables in\nthis manner.  This flag is off by default.\n\nshellnoargs      If set and sudo is invoked with no arguments it acts as if the -s option had\nbeen given.  That is, it runs a shell as root (the shell is determined by the\nSHELL environment variable if it is set, falling back on the shell listed in\nthe invoking user's /etc/passwd entry if not).  This flag is off by default.\n\nstaysetuid       Normally, when sudo executes a command the real and effective user-IDs are\nset to the target user (root by default).  This option changes that behavior\nsuch that the real user-ID is left as the invoking user's user-ID.  In other\nwords, this makes sudo act as a set-user-ID wrapper.  This can be useful on\nsystems that disable some potentially dangerous functionality when a program\nis run set-user-ID.  This option is only effective on systems that support\neither the setreuid(2) or setresuid(2) system call.  This flag is off by de‐\nfault.\n\nsudoeditcheckdir\nIf set, sudoedit will check all directory components of the path to be edited\nfor writability by the invoking user.  Symbolic links will not be followed in\nwritable directories and sudoedit will refuse to edit a file located in a\nwritable directory.  These restrictions are not enforced when sudoedit is run\nby root.  On some systems, if all directory components of the path to be\nedited are not readable by the target user, sudoedit will be unable to edit\nthe file.  This flag is on by default.\n\nThis setting was first introduced in version 1.8.15 but initially suffered\nfrom a race condition.  The check for symbolic links in writable intermediate\ndirectories was added in version 1.8.16.\n\nsudoeditfollow   By default, sudoedit will not follow symbolic links when opening files.  The\nsudoeditfollow option can be enabled to allow sudoedit to open symbolic\nlinks.  It may be overridden on a per-command basis by the FOLLOW and\nNOFOLLOW tags.  This flag is off by default.\n\nThis setting is only supported by version 1.8.15 or higher.\n\nsyslogpid        When logging via syslog(3), include the process ID in the log entry.  This\nflag is off by default.\n\nThis setting is only supported by version 1.8.21 or higher.\n\ntargetpw          If set, sudo will prompt for the password of the user specified by the -u op‐\ntion (defaults to root) instead of the password of the invoking user when\nrunning a command or editing a file.  Note that this flag precludes the use\nof a user-ID not listed in the passwd database as an argument to the -u op‐\ntion.  This flag is off by default.\n\nttytickets       If set, users must authenticate on a per-tty basis.  With this flag enabled,\nsudo will use a separate record in the time stamp file for each terminal.  If\ndisabled, a single record is used for all login sessions.\n\nThis option has been superseded by the timestamptype option.\n\numaskoverride    If set, sudo will set the umask as specified in the sudoers file without mod‐\nification.  This makes it possible to specify a umask in the sudoers file\nthat is more permissive than the user's own umask and matches historical be‐\nhavior.  If umaskoverride is not set, sudo will set the umask to be the\nunion of the user's umask and what is specified in sudoers.  This flag is off\nby default.\n\nusenetgroups     If set, netgroups (prefixed with ‘+’), may be used in place of a user or\nhost.  For LDAP-based sudoers, netgroup support requires an expensive sub-\nstring match on the server unless the NETGROUPBASE directive is present in\nthe /etc/ldap.conf file.  If netgroups are not needed, this option can be\ndisabled to reduce the load on the LDAP server.  This flag is on by default.\n\nusepty           If set, and sudo is running in a terminal, the command will be run in a\npseudo-terminal (even if no I/O logging is being done).  If the sudo process\nis not attached to a terminal, usepty has no effect.\n\nA malicious program run under sudo may be capable of injecting commands into\nthe user's terminal or running a background process that retains access to\nthe user's terminal device even after the main program has finished execut‐\ning.  By running the command in a separate pseudo-terminal, this attack is no\nlonger possible.  This flag is off by default.\n\nusercommandtimeouts\nIf set, the user may specify a timeout on the command line.  If the timeout\nexpires before the command has exited, the command will be terminated.  If a\ntimeout is specified both in the sudoers file and on the command line, the\nsmaller of the two timeouts will be used.  See the TimeoutSpec section for a\ndescription of the timeout syntax.  This flag is off by default.\n\nThis setting is only supported by version 1.8.20 or higher.\n\nutmprunas        If set, sudo will store the name of the runas user when updating the utmp (or\nutmpx) file.  By default, sudo stores the name of the invoking user.  This\nflag is off by default.\n\nvisiblepw         By default, sudo will refuse to run if the user must enter a password but it\nis not possible to disable echo on the terminal.  If the visiblepw flag is\nset, sudo will prompt for a password even when it would be visible on the\nscreen.  This makes it possible to run things like “ssh somehost sudo ls”\nsince by default, ssh(1) does not allocate a tty when running a command.\nThis flag is off by default.\n\nIntegers:\n\nclosefrom         Before it executes a command, sudo will close all open file descriptors other\nthan standard input, standard output, and standard error (file descriptors\n0-2).  The closefrom option can be used to specify a different file descrip‐\ntor at which to start closing.  The default is 3.\n\ncommandtimeout   The maximum amount of time a command is allowed to run before it is termi‐\nnated.  See the TimeoutSpec section for a description of the timeout syntax.\n\nThis setting is only supported by version 1.8.20 or higher.\n\nlogservertimeout\nThe maximum amount of time to wait when connecting to a log server or waiting\nfor a server response.  See the TimeoutSpec section for a description of the\ntimeout syntax.  The default value is 30 seconds.\n\nThis setting is only supported by version 1.9.0 or higher.\n\nmaxseq            The maximum sequence number that will be substituted for the “%{seq}” escape\nin the I/O log file (see the iologdir description below for more informa‐\ntion).  While the value substituted for “%{seq}” is in base 36, maxseq itself\nshould be expressed in decimal.  Values larger than 2176782336 (which corre‐\nsponds to the base 36 sequence number “ZZZZZZ”) will be silently truncated to\n2176782336.  The default value is 2176782336.\n\nOnce the local sequence number reaches the value of maxseq, it will “roll\nover” to zero, after which sudoers will truncate and re-use any existing I/O\nlog path names.\n\nThis setting is only supported by version 1.8.7 or higher.\n\npasswdtries      The number of tries a user gets to enter his/her password before sudo logs\nthe failure and exits.  The default is 3.\n\nsyslogmaxlen     On many systems, syslog(3) has a relatively small log buffer.  IETF RFC 5424\nstates that syslog servers must support messages of at least 480 bytes and\nshould support messages up to 2048 bytes.  By default, sudoers creates log\nmessages up to 980 bytes which corresponds to the historic BSD syslog imple‐\nmentation which used a 1024 byte buffer to store the message, date, hostname,\nand program name.  To prevent syslog messages from being truncated, sudoers\nwill split up log messages that are larger than syslogmaxlen bytes.  When a\nmessage is split, additional parts will include the string “(command\ncontinued)” after the user name and before the continued command line argu‐\nments.\n\nThis setting is only supported by version 1.8.19 or higher.\n\nIntegers that can be used in a boolean context:\n\nloglinelen        Number of characters per line for the file log.  This value is used to decide\nwhen to wrap lines for nicer log files.  This has no effect on the syslog log\nfile, only the file log.  The default is 80 (use 0 or negate the option to\ndisable word wrap).\n\npasswdtimeout    Number of minutes before the sudo password prompt times out, or 0 for no\ntimeout.  The timeout may include a fractional component if minute granular‐\nity is insufficient, for example 2.5.  The default is 0.\n\ntimestamptimeout\nNumber of minutes that can elapse before sudo will ask for a passwd again.\nThe timeout may include a fractional component if minute granularity is in‐\nsufficient, for example 2.5.  The default is 15.  Set this to 0 to always\nprompt for a password.  If set to a value less than 0 the user's time stamp\nwill not expire until the system is rebooted.  This can be used to allow\nusers to create or delete their own time stamps via “sudo -v” and “sudo -k”\nrespectively.\n\numask             File mode creation mask to use when running the command.  Negate this option\nor set it to 0777 to prevent sudoers from changing the umask.  Unless the\numaskoverride flag is set, the actual umask will be the union of the user's\numask and the value of the umask setting, which defaults to 0022.  This guar‐\nantees that sudo never lowers the umask when running a command.\n\nIf umask is explicitly set in sudoers, it will override any umask setting in\nPAM or login.conf.  If umask is not set in sudoers, the umask specified by\nPAM or login.conf will take precedence.  The umask setting in PAM is not used\nfor sudoedit, which does not create a new PAM session.\n\nStrings:\n\nauthfailmessage  Message that is displayed after a user fails to authenticate.  The message\nmay include the ‘%d’ escape which will expand to the number of failed pass‐\nword attempts.  If set, it overrides the default message, %d incorrect\npassword attempt(s).\n\nbadpassmessage   Message that is displayed if a user enters an incorrect password.  The de‐\nfault is Sorry, try again. unless insults are enabled.\n\neditor            A colon (‘:’) separated list of editors path names used by sudoedit and\nvisudo.  For sudoedit, this list is used to find an editor when none of the\nSUDOEDITOR, VISUAL or EDITOR environment variables are set to an editor that\nexists and is executable.  For visudo, it is used as a white list of allowed\neditors; visudo will choose the editor that matches the user's SUDOEDITOR,\nVISUAL or EDITOR environment variable if possible, or the first editor in the\nlist that exists and is executable if not.  Unless invoked as sudoedit, sudo\ndoes not preserve the SUDOEDITOR, VISUAL or EDITOR environment variables un‐\nless they are present in the envkeep list or the envreset option is dis‐\nabled.  The default is /usr/bin/editor.\n\niologdir         The top-level directory to use when constructing the path name for the in‐\nput/output log directory.  Only used if the loginput or logoutput options\nare enabled or when the LOGINPUT or LOGOUTPUT tags are present for a com‐\nmand.  The session sequence number, if any, is stored in the directory.  The\ndefault is /var/log/sudo-io.\n\nThe following percent (‘%’) escape sequences are supported:\n\n%{seq}\nexpanded to a monotonically increasing base-36 sequence number, such as\n0100A5, where every two digits are used to form a new directory, e.g.,\n01/00/A5\n\n%{user}\nexpanded to the invoking user's login name\n\n%{group}\nexpanded to the name of the invoking user's real group-ID\n\n%{runasuser}\nexpanded to the login name of the user the command will be run as\n(e.g., root)\n\n%{runasgroup}\nexpanded to the group name of the user the command will be run as\n(e.g., wheel)\n\n%{hostname}\nexpanded to the local host name without the domain name\n\n%{command}\nexpanded to the base name of the command being run\n\nIn addition, any escape sequences supported by the system's strftime(3) func‐\ntion will be expanded.\n\nTo include a literal ‘%’ character, the string ‘%%’ should be used.\n\niologfile        The path name, relative to iologdir, in which to store input/output logs\nwhen the loginput or logoutput options are enabled or when the LOGINPUT or\nLOGOUTPUT tags are present for a command.  Note that iologfile may contain\ndirectory components.  The default is “%{seq}”.\n\nSee the iologdir option above for a list of supported percent (‘%’) escape\nsequences.\n\nIn addition to the escape sequences, path names that end in six or more Xs\nwill have the Xs replaced with a unique combination of digits and letters,\nsimilar to the mktemp(3) function.\n\nIf the path created by concatenating iologdir and iologfile already exists,\nthe existing I/O log file will be truncated and overwritten unless iologfile\nends in six or more Xs.\n\niologflush       If set, sudo will flush I/O log data to disk after each write instead of\nbuffering it.  This makes it possible to view the logs in real-time as the\nprogram is executing but may significantly reduce the effectiveness of I/O\nlog compression.  This flag is off by default.\n\nThis setting is only supported by version 1.8.20 or higher.\n\niologgroup       The group name to look up when setting the group-ID on new I/O log files and\ndirectories.  If iologgroup is not set, the primary group-ID of the user\nspecified by iologuser is used.  If neither iologgroup nor iologuser are\nset, I/O log files and directories are created with group-ID 0.\n\nThis setting is only supported by version 1.8.19 or higher.\n\niologmode        The file mode to use when creating I/O log files.  Mode bits for read and\nwrite permissions for owner, group, or other are honored, everything else is\nignored.  The file permissions will always include the owner read and write\nbits, even if they are not present in the specified mode.  When creating I/O\nlog directories, search (execute) bits are added to match the read and write\nbits specified by iologmode.  Defaults to 0600 (read and write by user\nonly).\n\nThis setting is only supported by version 1.8.19 or higher.\n\niologuser        The user name to look up when setting the user and group-IDs on new I/O log\nfiles and directories.  If iologgroup is set, it will be used instead of the\nuser's primary group-ID.  By default, I/O log files and directories are cre‐\nated with user and group-ID 0.\n\nThis setting can be useful when the I/O logs are stored on a Network File\nSystem (NFS) share.  Having a dedicated user own the I/O log files means that\nsudoers does not write to the log files as user-ID 0, which is usually not\npermitted by NFS.\n\nThis setting is only supported by version 1.8.19 or higher.\n\nlecturestatusdir\nThe directory in which sudo stores per-user lecture status files.  Once a\nuser has received the lecture, a zero-length file is created in this direc‐\ntory so that sudo will not lecture the user again.  This directory should not\nbe cleared when the system reboots.  The default is /var/lib/sudo/lectured.\n\nlogservercabundle\nThe path to a certificate authority bundle file, in PEM format, to use in‐\nstead of the system's default certificate authority database when authenti‐\ncating the log server.  The default is to use the system's default certifi‐\ncate authority database.  This setting has no effect unless logservers is\nset and the remote log server is secured with TLS.\n\nThis setting is only supported by version 1.9.0 or higher.\n\nlogserverpeercert\nThe path to the sudo client's certificate file, in PEM format.  This setting\nis required when the remote log server is secured with TLS and client cer‐\ntificate validation is enabled.  For sudologsrvd, client certificate valida‐\ntion is controlled by the tlscheckpeer option, which defaults to false.\n\nThis setting is only supported by version 1.9.0 or higher.\n\nlogserverpeerkey\nThe path to the sudo client's private key file, in PEM format.  This setting\nis required when the remote log server is secured with TLS and client cer‐\ntificate validation is enabled.  For sudologsrvd, client certificate valida‐\ntion is controlled by the tlscheckpeer option, which defaults to false.\n\nThis setting is only supported by version 1.9.0 or higher.\n\nmailsub           Subject of the mail sent to the mailto user.  The escape %h will expand to\nthe host name of the machine.  Default is “* SECURITY information for %h\n*”.\n\nnoexecfile       As of sudo version 1.8.1 this option is no longer supported.  The path to the\nnoexec file should now be set in the sudo.conf(5) file.\n\npamaskpassservice\nOn systems that use PAM for authentication, this is the service name used\nwhen the -A option is specified.  The default value is either “@pamservice@”\nor “sudo-i”, depending on whether or not the -i option is also specified.\nSee the description of pamservice for more information.\n\nThis setting is only supported by version 1.9.9 or higher.\n\npamloginservice\nOn systems that use PAM for authentication, this is the service name used\nwhen the -i option is specified.  The default value is “sudo-i”.  See the de‐\nscription of pamservice for more information.\n\nThis setting is only supported by version 1.8.8 or higher.\n\npamservice       On systems that use PAM for authentication, the service name specifies the\nPAM policy to apply.  This usually corresponds to an entry in the pam.conf\nfile or a file in the /etc/pam.d directory.  The default value is “sudo”.\n\nThis setting is only supported by version 1.8.8 or higher.\n\npassprompt        The default prompt to use when asking for a password; can be overridden via\nthe -p option or the SUDOPROMPT environment variable.  The following percent\n(‘%’) escape sequences are supported:\n\n%H    expanded to the local host name including the domain name (only if the\nmachine's host name is fully qualified or the fqdn option is set)\n\n%h    expanded to the local host name without the domain name\n\n%p    expanded to the user whose password is being asked for (respects the\nrootpw, targetpw and runaspw flags in sudoers)\n\n%U    expanded to the login name of the user the command will be run as (de‐\nfaults to root)\n\n%u    expanded to the invoking user's login name\n\n%%    two consecutive % characters are collapsed into a single % character\n\nOn systems that use PAM for authentication, passprompt will only be used if\nthe prompt provided by the PAM module matches the string “Password: ” or\n“username's Password: ”.  This ensures that the passprompt setting does not\ninterfere with challenge-response style authentication.  The\npasspromptoverride flag can be used to change this behavior.\n\nThe default value is “[sudo] password for %p: ”.\n\nrole              The default SELinux role to use when constructing a new security context to\nrun the command.  The default role may be overridden on a per-command basis\nin the sudoers file or via command line options.  This option is only avail‐\nable when sudo is built with SELinux support.\n\nrunasdefault     The default user to run commands as if the -u option is not specified on the\ncommand line.  This defaults to root.\n\nsudoerslocale    Locale to use when parsing the sudoers file, logging commands, and sending\nemail.  Note that changing the locale may affect how sudoers is interpreted.\nDefaults to “C”.\n\ntimestamptype    sudoers uses per-user time stamp files for credential caching.  The\ntimestamptype option can be used to specify the type of time stamp record\nused.  It has the following possible values:\n\nglobal  A single time stamp record is used for all of a user's login ses‐\nsions, regardless of the terminal or parent process ID.  An addi‐\ntional record is used to serialize password prompts when sudo is used\nmultiple times in a pipeline, but this does not affect authentica‐\ntion.\n\nppid    A single time stamp record is used for all processes with the same\nparent process ID (usually the shell).  Commands run from the same\nshell (or other common parent process) will not require a password\nfor timestamptimeout minutes (15 by default).  Commands run via sudo\nwith a different parent process ID, for example from a shell script,\nwill be authenticated separately.\n\ntty     One time stamp record is used for each terminal, which means that a\nuser's login sessions are authenticated separately.  If no terminal\nis present, the behavior is the same as ppid.  Commands run from the\nsame terminal will not require a password for timestamptimeout min‐\nutes (15 by default).\n\nkernel  The time stamp is stored in the kernel as an attribute of the termi‐\nnal device.  If no terminal is present, the behavior is the same as\nppid.  Negative timestamptimeout values are not supported and posi‐\ntive values are limited to a maximum of 60 minutes.  This is cur‐\nrently only supported on OpenBSD.\n\nThe default value is tty.\n\nThis setting is only supported by version 1.8.21 or higher.\n\ntimestampdir      The directory in which sudo stores its time stamp files.  This directory\nshould be cleared when the system reboots.  The default is /run/sudo/ts.\n\ntimestampowner    The owner of the lecture status directory, time stamp directory and all files\nstored therein.  The default is root.\n\ntype              The default SELinux type to use when constructing a new security context to\nrun the command.  The default type may be overridden on a per-command basis\nin the sudoers file or via command line options.  This option is only avail‐\nable when sudo is built with SELinux support.\n\nStrings that can be used in a boolean context:\n\nadminflag    The adminflag option specifies the path to a file that is created the first time\na user that is a member of the sudo or admin groups runs sudo.  Only available if\nsudo is configured with the --enable-admin-flag option.  The default value is\n~/.sudoasadminsuccessful.\n\nenvfile      The envfile option specifies the fully qualified path to a file containing vari‐\nables to be set in the environment of the program being run.  Entries in this\nfile should either be of the form “VARIABLE=value” or “export VARIABLE=value”.\nThe value may optionally be enclosed in single or double quotes.  Variables in\nthis file are only added if the variable does not already exist in the environ‐\nment.  This file is considered to be part of the security policy, its contents\nare not subject to other sudo environment restrictions such as envkeep and\nenvcheck.\n\nexemptgroup  Users in this group are exempt from password and PATH requirements.  The group\nname specified should not include a % prefix.  This is not set by default.\n\nfdexec        Determines whether sudo will execute a command by its path or by an open file de‐\nscriptor.  It has the following possible values:\n\nalways  Always execute by file descriptor.\n\nnever   Never execute by file descriptor.\n\ndigestonly\nOnly execute by file descriptor if the command has an associated digest\nin the sudoers file.\n\nThe default value is digestonly.  This avoids a time of check versus time of use\nrace condition when the command is located in a directory writable by the invok‐\ning user.\n\nNote that fdexec will change the first element of the argument vector for scripts\n($0 in the shell) due to the way the kernel runs script interpreters.  Instead of\nbeing a normal path, it will refer to a file descriptor.  For example, /dev/fd/4\non Solaris and /proc/self/fd/4 on Linux.  A workaround is to use the SUDOCOMMAND\nenvironment variable instead.\n\nThe fdexec setting is only used when the command is matched by path name.  It has\nno effect if the command is matched by the built-in ALL alias.\n\nThis setting is only supported by version 1.8.20 or higher.  If the operating\nsystem does not support the fexecve() system call, this setting has no effect.\n\ngroupplugin  A string containing a sudoers group plugin with optional arguments.  The string\nshould consist of the plugin path, either fully-qualified or relative to the\n/usr/libexec/sudo directory, followed by any configuration arguments the plugin\nrequires.  These arguments (if any) will be passed to the plugin's initialization\nfunction.  If arguments are present, the string must be enclosed in double quotes\n(\"\").\n\nFor more information see GROUP PROVIDER PLUGINS.\n\nlecture       This option controls when a short lecture will be printed along with the password\nprompt.  It has the following possible values:\n\nalways  Always lecture the user.\n\nnever   Never lecture the user.\n\nonce    Only lecture the user the first time they run sudo.\n\nIf no value is specified, a value of once is implied.  Negating the option re‐\nsults in a value of never being used.  The default value is never.\n\nlecturefile  Path to a file containing an alternate sudo lecture that will be used in place of\nthe standard lecture if the named file exists.  By default, sudo uses a built-in\nlecture.\n\nlistpw        This option controls when a password will be required when a user runs sudo with\nthe -l option.  It has the following possible values:\n\nall       All the user's sudoers file entries for the current host must have the\nNOPASSWD flag set to avoid entering a password.\n\nalways    The user must always enter a password to use the -l option.\n\nany       At least one of the user's sudoers file entries for the current host\nmust have the NOPASSWD flag set to avoid entering a password.\n\nnever     The user need never enter a password to use the -l option.\n\nIf no value is specified, a value of any is implied.  Negating the option results\nin a value of never being used.  The default value is any.\n\nlogformat    The event log format.  Supported log formats are:\n\njson      Logs in JSON format.  JSON log entries contain the full user details as\nwell as the execution environment if the command was allowed.  Due to\nlimitations of the protocol, JSON events sent via syslog may be trun‐\ncated.\n\nsudo      Traditional sudo-style logs, see LOG FORMAT for a description of the\nlog file format.\n\nThis setting affects logs sent via syslog(3) as well as the file specified by the\nlogfile setting, if any.  The default value is sudo.\n\nlogfile       Path to the sudo log file (not the syslog log file).  Setting a path turns on\nlogging to a file; negating this option turns it off.  By default, sudo logs via\nsyslog.\n\nmailerflags   Flags to use when invoking mailer.  Defaults to -t.\n\nmailerpath    Path to mail program used to send warning mail.  Defaults to the path to sendmail\nfound at configure time.\n\nmailfrom      Address to use for the “from” address when sending warning and error mail.  The\naddress should be enclosed in double quotes (\"\") to protect against sudo inter‐\npreting the @ sign.  Defaults to the name of the user running sudo.\n\nmailto        Address to send warning and error mail to.  The address should be enclosed in\ndouble quotes (\"\") to protect against sudo interpreting the @ sign.  Defaults to\nroot.\n\nrlimitas     The maximum size to which the process's address space may grow (in bytes), if\nsupported by the operating system.  See Resource limits for more information.\n\nrlimitcore   The largest size core dump file that may be created (in bytes).  See Resource\nlimits for more information.  Defaults to 0 (no core dump created).\n\nrlimitcpu    The maximum amount of CPU time that the process may use (in seconds).  See\nResource limits for more information.\n\nrlimitdata   The maximum size of the data segment for the process (in bytes).  See Resource\nlimits for more information.\n\nrlimitfsize  The largest size file that the process may create (in bytes).  See Resource\nlimits for more information.\n\nrlimitlocks  The maximum number of locks that the process may establish, if supported by the\noperating system.  See Resource limits for more information.\n\nrlimitmemlock\nThe maximum size that the process may lock in memory (in bytes), if supported by\nthe operating system.  See Resource limits for more information.\n\nrlimitnofile\nThe maximum number of files that the process may have open.  See Resource limits\nfor more information.\n\nrlimitnproc  The maximum number of processes that the user may run simultaneously.  See\nResource limits for more information.\n\nrlimitrss    The maximum size to which the process's resident set size may grow (in bytes).\nSee Resource limits for more information.\n\nrlimitstack  The maximum size to which the process's stack may grow (in bytes).  See Resource\nlimits for more information.\n\nrestrictedenvfile\nThe restrictedenvfile option specifies the fully qualified path to a file con‐\ntaining variables to be set in the environment of the program being run.  Entries\nin this file should either be of the form “VARIABLE=value” or “export\nVARIABLE=value”.  The value may optionally be enclosed in single or double\nquotes.  Variables in this file are only added if the variable does not already\nexist in the environment.  Unlike envfile, the file's contents are not trusted\nand are processed in a manner similar to that of the invoking user's environment.\nIf envreset is enabled, variables in the file will only be added if they are\nmatched by either the envcheck or envkeep list.  If envreset is disabled,\nvariables in the file are added as long as they are not matched by the envdelete\nlist.  In either case, the contents of restrictedenvfile are processed before\nthe contents of envfile.\n\nrunchroot     If set, sudo will use this value for the root directory when running a command.\nThe special value “*” will allow the user to specify the root directory via\nsudo's -R option.  See the ChrootSpec section for more details.\n\nIt is only possible to use runchroot as a command-specific Defaults setting if\nthe command exists with the same path both inside and outside the chroot jail.\nThis restriction does not apply to generic, host, or user-based Defaults settings\nor to a CmndSpec that includes a ChrootSpec.\n\nThis setting is only supported by version 1.9.3 or higher.\n\nruncwd        If set, sudo will use this value for the working directory when running a com‐\nmand.  The special value “*” will allow the user to specify the working directory\nvia sudo's -D option.  See the ChdirSpec section for more details.\n\nThis setting is only supported by version 1.9.3 or higher.\n\nsecurepath   If set, sudo will use this value in place of the user's PATH environment vari‐\nable.  This option can be used to reset the PATH to a known good value that con‐\ntains directories for system administrator commands such as /usr/sbin.\n\nUsers in the group specified by the exemptgroup option are not affected by\nsecurepath.  This option is not set by default.\n\nsyslog        Syslog facility if syslog is being used for logging (negate to disable syslog\nlogging).  Defaults to authpriv.\n\nThe following syslog facilities are supported: authpriv (if your OS supports it),\nauth, daemon, user, local0, local1, local2, local3, local4, local5, local6, and\nlocal7.\n\nsyslogbadpri\nSyslog priority to use when the user is not allowed to run a command or when au‐\nthentication is unsuccessful.  Defaults to alert.\n\nThe following syslog priorities are supported: alert, crit, debug, emerg, err,\ninfo, notice, warning, and none.  Negating the option or setting it to a value of\nnone will disable logging of unsuccessful commands.\n\nsysloggoodpri\nSyslog priority to use when the user is allowed to run a command and authentica‐\ntion is successful.  Defaults to notice.\n\nSee syslogbadpri for the list of supported syslog priorities.  Negating the op‐\ntion or setting it to a value of none will disable logging of successful com‐\nmands.\n\nverifypw      This option controls when a password will be required when a user runs sudo with\nthe -v option.  It has the following possible values:\n\nall     All the user's sudoers file entries for the current host must have the\nNOPASSWD flag set to avoid entering a password.\n\nalways  The user must always enter a password to use the -v option.\n\nany     At least one of the user's sudoers file entries for the current host must\nhave the NOPASSWD flag set to avoid entering a password.\n\nnever   The user need never enter a password to use the -v option.\n\nIf no value is specified, a value of all is implied.  Negating the option results\nin a value of never being used.  The default value is all.\n\nLists that can be used in a boolean context:\n\nenvcheck         Environment variables to be removed from the user's environment unless they\nare considered “safe”.  For all variables except TZ, “safe” means that the\nvariable's value does not contain any ‘%’ or ‘/’ characters.  This can be\nused to guard against printf-style format vulnerabilities in poorly-written\nprograms.  The TZ variable is considered unsafe if any of the following are\ntrue:\n\n••  It consists of a fully-qualified path name, optionally prefixed with a\ncolon (‘:’), that does not match the location of the zoneinfo directory.\n\n••  It contains a .. path element.\n\n••  It contains white space or non-printable characters.\n\n••  It is longer than the value of PATHMAX.\n\nThe argument may be a double-quoted, space-separated list or a single value\nwithout double-quotes.  The list can be replaced, added to, deleted from, or\ndisabled by using the =, +=, -=, and ! operators respectively.  Regardless of\nwhether the envreset option is enabled or disabled, variables specified by\nenvcheck will be preserved in the environment if they pass the aforemen‐\ntioned check.  The global list of environment variables to check is displayed\nwhen sudo is run by root with the -V option.\n\nenvdelete        Environment variables to be removed from the user's environment when the\nenvreset option is not in effect.  The argument may be a double-quoted,\nspace-separated list or a single value without double-quotes.  The list can\nbe replaced, added to, deleted from, or disabled by using the =, +=, -=, and\n! operators respectively.  The global list of environment variables to remove\nis displayed when sudo is run by root with the -V option.  Note that many op‐\nerating systems will remove potentially dangerous variables from the environ‐\nment of any set-user-ID process (such as sudo).\n\nenvkeep          Environment variables to be preserved in the user's environment when the\nenvreset option is in effect.  This allows fine-grained control over the en‐\nvironment sudo-spawned processes will receive.  The argument may be a double-\nquoted, space-separated list or a single value without double-quotes.  The\nlist can be replaced, added to, deleted from, or disabled by using the =, +=,\n-=, and ! operators respectively.  The global list of variables to keep is\ndisplayed when sudo is run by root with the -V option.\n\nPreserving the HOME environment variable has security implications since many\nprograms use it when searching for configuration or data files.  Adding HOME\nto envkeep may enable a user to run unrestricted commands via sudo and is\nstrongly discouraged.  Users wishing to edit files with sudo should run\nsudoedit (or sudo -e) to get their accustomed editor configuration instead of\ninvoking the editor directly.\n\nlogservers       A list of one or more servers to use for remote event and I/O log storage,\nseparated by white space.  Log servers must be running sudologsrvd or an‐\nother service that implements the protocol described by sudologsrv.proto(5).\n\nServer addresses should be of the form “host[:port][(tls)]”.  The host por‐\ntion may be a host name, an IPv4 address, or an IPv6 address in square brack‐\nets.\n\nIf the optional tls flag is present, the connection will be secured with\nTransport Layer Security (TLS) version 1.2 or 1.3.  Versions of TLS prior to\n1.2 are not supported.\n\nIf a port is specified, it may either be a port number or a well-known ser‐\nvice name as defined by the system service name database.  If no port is\nspecified, port 30343 will be used for plaintext connections and port 30344\nwill be used for TLS connections.\n\nWhen logservers is set, event log data will be logged both locally (see the\nsyslog and logfile settings) as well as remotely, but I/O log data will only\nbe logged remotely.  If multiple hosts are specified, they will be attempted\nin reverse order.  If no log servers are available, the user will not be able\nto run a command unless either the ignoreiologerrors flag (I/O logging en‐\nabled) or the ignorelogerrors flag (I/O logging disabled) is set.  Like‐\nwise, if the connection to the log server is interrupted while sudo is run‐\nning, the command will be terminated unless the ignoreiologerrors flag (I/O\nlogging enabled) or the ignorelogerrors flag (I/O logging disabled) is set.\n\nThis setting is only supported by version 1.9.0 or higher.\n",
            "subsections": []
        },
        "GROUP PROVIDER PLUGINS": {
            "content": "The sudoers plugin supports its own plugin interface to allow non-Unix group lookups which can\nquery a group source other than the standard Unix group database.  This can be used to imple‐\nment support for the nonunixgroup syntax described earlier.\n\nGroup provider plugins are specified via the groupplugin setting.  The argument to\ngroupplugin should consist of the plugin path, either fully-qualified or relative to the\n/usr/libexec/sudo directory, followed by any configuration options the plugin requires.  These\noptions (if specified) will be passed to the plugin's initialization function.  If options are\npresent, the string must be enclosed in double quotes (\"\").\n\nThe following group provider plugins are installed by default:\n\ngroupfile\nThe groupfile plugin supports an alternate group file that uses the same syntax as\nthe /etc/group file.  The path to the group file should be specified as an option to\nthe plugin.  For example, if the group file to be used is /etc/sudo-group:\n\nDefaults groupplugin=\"groupfile.so /etc/sudo-group\"\n\nsystemgroup\nThe systemgroup plugin supports group lookups via the standard C library functions\ngetgrnam() and getgrid().  This plugin can be used in instances where the user be‐\nlongs to groups not present in the user's supplemental group vector.  This plugin\ntakes no options:\n\nDefaults groupplugin=systemgroup.so\n\nThe group provider plugin API is described in detail in sudoplugin(5).\n",
            "subsections": []
        },
        "LOG FORMAT": {
            "content": "sudoers can log events in either JSON or sudo format, this section describes the sudo log for‐\nmat.  Depending on sudoers configuration, sudoers can log events via syslog(3), to a local log\nfile, or both.  The log format is almost identical in both cases.  Any control characters\npresent in the log data are formatted in octal with a leading ‘#’ character.  For example, a\nhorizontal tab is stored as ‘#011’ and an embedded carriage return is stored as ‘#015’.  In ad‐\ndition, space characters in the command path are stored as ‘#040’.  Command line arguments that\ncontain spaces are enclosed in single quotes ('').  This makes it possible to distinguish mul‐\ntiple command line arguments from a single argument that contains spaces.  Literal single\nquotes and backslash characters (‘\\’) in command line arguments are escaped with a backslash.\n",
            "subsections": [
                {
                    "name": "Accepted command log entries",
                    "content": "Commands that sudo runs are logged using the following format (split into multiple lines for\nreadability):\n\ndate hostname progname: username : TTY=ttyname ; CHROOT=chroot ; \\\nPWD=cwd ; USER=runasuser ; GROUP=runasgroup ; TSID=logid ; \\\nENV=envvars COMMAND=command\n\nWhere the fields are as follows:\n\ndate          The date the command was run.  Typically, this is in the format “MMM, DD,\nHH:MM:SS”.  If logging via syslog(3), the actual date format is controlled by the\nsyslog daemon.  If logging to a file and the logyear option is enabled, the date\nwill also include the year.\n\nhostname      The name of the host sudo was run on.  This field is only present when logging\nvia syslog(3).\n\nprogname      The name of the program, usually sudo or sudoedit.  This field is only present\nwhen logging via syslog(3).\n\nusername      The login name of the user who ran sudo.\n\nttyname       The short name of the terminal (e.g., “console”, “tty01”, or “pts/0”) sudo was\nrun on, or “unknown” if there was no terminal present.\n\nchroot        The root directory that the command was run in, if one was specified.\n\ncwd           The current working directory that sudo was run in.\n\nrunasuser     The user the command was run as.\n\nrunasgroup    The group the command was run as if one was specified on the command line.\n\nlogid         An I/O log identifier that can be used to replay the command's output.  This is\nonly present when the loginput or logoutput option is enabled.\n\nenvvars      A list of environment variables specified on the command line, if specified.\n\ncommand       The actual command that was executed, including any command line arguments.\n\nMessages are logged using the locale specified by sudoerslocale, which defaults to the “C” lo‐\ncale.\n"
                },
                {
                    "name": "Denied command log entries",
                    "content": "If the user is not allowed to run the command, the reason for the denial will follow the user\nname.  Possible reasons include:\n\nuser NOT in sudoers\nThe user is not listed in the sudoers file.\n\nuser NOT authorized on host\nThe user is listed in the sudoers file but is not allowed to run commands on the host.\n\ncommand not allowed\nThe user is listed in the sudoers file for the host but they are not allowed to run the spec‐\nified command.\n\n3 incorrect password attempts\nThe user failed to enter their password after 3 tries.  The actual number of tries will vary\nbased on the number of failed attempts and the value of the passwdtries option.\n\na password is required\nThe -n option was specified but a password was required.\n\nsorry, you are not allowed to set the following environment variables\nThe user specified environment variables on the command line that were not allowed by\nsudoers.\n"
                },
                {
                    "name": "Error log entries",
                    "content": "If an error occurs, sudoers will log a message and, in most cases, send a message to the admin‐\nistrator via email.  Possible errors include:\n\nparse error in /etc/sudoers near line N\nsudoers encountered an error when parsing the specified file.  In some cases, the actual er‐\nror may be one line above or below the line number listed, depending on the type of error.\n\nproblem with defaults entries\nThe sudoers file contains one or more unknown Defaults settings.  This does not prevent sudo\nfrom running, but the sudoers file should be checked using visudo.\n\ntimestamp owner (username): No such user\nThe time stamp directory owner, as specified by the timestampowner setting, could not be\nfound in the password database.\n\nunable to open/read /etc/sudoers\nThe sudoers file could not be opened for reading.  This can happen when the sudoers file is\nlocated on a remote file system that maps user-ID 0 to a different value.  Normally, sudoers\ntries to open the sudoers file using group permissions to avoid this problem.  Consider ei‐\nther changing the ownership of /etc/sudoers or adding an argument like “sudoersuid=N” (where\n‘N’ is the user-ID that owns the sudoers file) to the end of the sudoers Plugin line in the\nsudo.conf(5) file.\n\nunable to stat /etc/sudoers\nThe /etc/sudoers file is missing.\n\n/etc/sudoers is not a regular file\nThe /etc/sudoers file exists but is not a regular file or symbolic link.\n\n/etc/sudoers is owned by uid N, should be 0\nThe sudoers file has the wrong owner.  If you wish to change the sudoers file owner, please\nadd “sudoersuid=N” (where ‘N’ is the user-ID that owns the sudoers file) to the sudoers\nPlugin line in the sudo.conf(5) file.\n\n/etc/sudoers is world writable\nThe permissions on the sudoers file allow all users to write to it.  The sudoers file must\nnot be world-writable, the default file mode is 0440 (readable by owner and group, writable\nby none).  The default mode may be changed via the “sudoersmode” option to the sudoers\nPlugin line in the sudo.conf(5) file.\n\n/etc/sudoers is owned by gid N, should be 1\nThe sudoers file has the wrong group ownership.  If you wish to change the sudoers file group\nownership, please add “sudoersgid=N” (where ‘N’ is the group-ID that owns the sudoers file)\nto the sudoers Plugin line in the sudo.conf(5) file.\n\nunable to open /run/sudo/ts/username\nsudoers was unable to read or create the user's time stamp file.  This can happen when\ntimestampowner is set to a user other than root and the mode on /run/sudo is not searchable\nby group or other.  The default mode for /run/sudo is 0711.\n\nunable to write to /run/sudo/ts/username\nsudoers was unable to write to the user's time stamp file.\n\n/run/sudo/ts is owned by uid X, should be Y\nThe time stamp directory is owned by a user other than timestampowner.  This can occur when\nthe value of timestampowner has been changed.  sudoers will ignore the time stamp directory\nuntil the owner is corrected.\n\n/run/sudo/ts is group writable\nThe time stamp directory is group-writable; it should be writable only by timestampowner.\nThe default mode for the time stamp directory is 0700.  sudoers will ignore the time stamp\ndirectory until the mode is corrected.\n"
                },
                {
                    "name": "Notes on logging via syslog",
                    "content": "By default, sudoers logs messages via syslog(3).  The date, hostname, and progname fields are\nadded by the system's syslog() function, not sudoers itself.  As such, they may vary in format\non different systems.\n\nThe maximum size of syslog messages varies from system to system.  The syslogmaxlen setting\ncan be used to change the maximum syslog message size from the default value of 980 bytes.  For\nmore information, see the description of syslogmaxlen.\n"
                },
                {
                    "name": "Notes on logging to a file",
                    "content": "If the logfile option is set, sudoers will log to a local file, such as /var/log/sudo.  When\nlogging to a file, sudoers uses a format similar to syslog(3), with a few important differ‐\nences:\n\n1.   The progname field is not present.\n\n2.   The hostname is only logged if the loghost option is enabled.\n\n3.   The date does not include the year unless the logyear option is enabled.\n\n4.   Lines that are longer than loglinelen characters (80 by default) are word-wrapped and con‐\ntinued on the next line with a four character indent.  This makes entries easier to read\nfor a human being, but makes it more difficult to use grep(1) on the log files.  If the\nloglinelen option is set to 0 (or negated with a ‘!’), word wrap will be disabled.\n"
                }
            ]
        },
        "I/O LOG FILES": {
            "content": "When I/O logging is enabled, sudo will run the command in a pseudo-terminal and log all user\ninput and/or output, depending on which options are enabled.  I/O can be logged either to the\nlocal machine or to a remote log server.  For local logs, I/O is logged to the directory speci‐\nfied by the iologdir option (/var/log/sudo-io by default) using a unique session ID that is\nincluded in the sudo log line, prefixed with “TSID=”.  The iologfile option may be used to\ncontrol the format of the session ID.  For remote logs, the logservers setting is used to\nspecify one or more log servers running sudologsrvd or another server that implements the pro‐\ntocol described by sudologsrv.proto(5).\n\nFor both local and remote I/O logs, each log is stored in a separate directory that contains\nthe following files:\n\nlog       A text file containing information about the command.  The first line consists of the\nfollowing colon-delimited fields: the time the command was run, the name of the user\nwho ran sudo, the name of the target user, the name of the target group (optional),\nthe terminal that sudo was run from, and the number of lines and columns of the ter‐\nminal.  The second and third lines contain the working directory the command was run\nfrom and the path name of the command itself (with arguments if present).\n\nlog.json  A JSON-formatted file containing information about the command.  This is similar to\nthe log file but contains additional information and is easily extensible.  The\nlog.json file will be used by sudoreplay(8) in preference to the log file if it ex‐\nists.  The file may contain the following elements:\n\ntimestamp\nA JSON object containing time the command was run.  It consists of two val‐\nues, seconds and nanoseconds.\n\ncolumns   The number of columns of the terminal the command ran on, or zero if no\nterminal was present.\n\ncommand   The fully-qualified path of the command that was run.\n\nlines     The number of lines of the terminal the command ran on, or zero if no ter‐\nminal was present.\n\nrunargv   A JSON array representing the command's argument vector as passed to the\nexecve() system call.\n\nrunenv    A JSON array representing the command's environment as passed to the\nexecve() system call.\n\nrungid    The group ID the command ran as.  This element is only present when the\nuser specifies a group on the command line.\n\nrungroup  The name of the group the command ran as.  This element is only present\nwhen the user specifies a group on the command line.\n\nrunuid    The user ID the command ran as.\n\nrunuser   The name of the user the command ran as.\n\nsubmitcwd\nThe current working directory at the time sudo was run.\n\nsubmithost\nThe name of the host the command was run on.\n\nsubmituser\nThe name of the user who ran the command via sudo.\n\nttyname   The path name of the terminal the user invoked sudo from.  If the command\nwas run in a pseudo-terminal, ttyname will be different from the terminal\nthe command actually ran in.\n\ntiming    Timing information used to replay the session.  Each line consists of the I/O log en‐\ntry type and amount of time since the last entry, followed by type-specific data.\nThe I/O log entry types and their corresponding type-specific data are:\n\n0     standard input, number of bytes in the entry\n1     standard output, number of bytes in the entry\n2     standard error, number of bytes in the entry\n3     terminal input, number of bytes in the entry\n4     terminal output, number of bytes in the entry\n5     window change, new number lines and columns\n6     bug compatibility for sudo 1.8.7 terminal output\n7     command suspend or resume, signal received\n\nttyin     Raw input from the user's terminal, exactly as it was received.  No post-processing\nis performed.  For manual viewing, you may wish to convert carriage return characters\nin the log to line feeds.  For example: ‘gunzip -c ttyin | tr \"\\r\" \"\\n\"’\n\nstdin     The standard input when no terminal is present, or input redirected from a pipe or\nfile.\n\nttyout    Output from the pseudo-terminal (what the command writes to the screen).  Note that\nterminal-specific post-processing is performed before the data is logged.  This means\nthat, for example, line feeds are usually converted to line feed/carriage return\npairs and tabs may be expanded to spaces.\n\nstdout    The standard output when no terminal is present, or output redirected to a pipe or\nfile.\n\nstderr    The standard error redirected to a pipe or file.\n\nAll files other than log are compressed in gzip format unless the compressio flag has been\ndisabled.  Due to buffering, it is not normally possible to display the I/O logs in real-time\nas the program is executing.  The I/O log data will not be complete until the program run by\nsudo has exited or has been terminated by a signal.  The iologflush flag can be used to dis‐\nable buffering, in which case I/O log data is written to disk as soon as it is available.  The\noutput portion of an I/O log file can be viewed with the sudoreplay(8) utility, which can also\nbe used to list or search the available logs.\n\nNote that user input may contain sensitive information such as passwords (even if they are not\nechoed to the screen), which will be stored in the log file unencrypted.  In most cases, log‐\nging the command output via logoutput or LOGOUTPUT is all that is required.\n\nSince each session's I/O logs are stored in a separate directory, traditional log rotation\nutilities cannot be used to limit the number of I/O logs.  The simplest way to limit the number\nof I/O is by setting the maxseq option to the maximum number of logs you wish to store.  Once\nthe I/O log sequence number reaches maxseq, it will be reset to zero and sudoers will truncate\nand re-use any existing I/O logs.\n",
            "subsections": []
        },
        "FILES": {
            "content": "/etc/sudo.conf            Sudo front-end configuration\n\n/etc/sudoers              List of who can run what\n\n/etc/group                Local groups file\n\n/etc/netgroup             List of network groups\n\n/var/log/sudo-io          I/O log files\n\n/run/sudo/ts              Directory containing time stamps for the sudoers security policy\n\n/var/lib/sudo/lectured    Directory containing lecture status files for the sudoers security\npolicy\n\n/etc/environment          Initial environment for -i mode on AIX and Linux systems\n",
            "subsections": []
        },
        "EXAMPLES": {
            "content": "Below are example sudoers file entries.  Admittedly, some of these are a bit contrived.  First,\nwe allow a few environment variables to pass and then define our aliases:\n\n# Run X applications through sudo; HOME is used to find the\n# .Xauthority file.  Note that other programs use HOME to find\n# configuration files and this may lead to privilege escalation!\nDefaults envkeep += \"DISPLAY HOME\"\n\n# User alias specification\nUserAlias      FULLTIMERS = millert, mikef, dowdy\nUserAlias      PARTTIMERS = bostley, jwfox, crawl\nUserAlias      WEBADMIN = will, wendy, wim\n\n# Runas alias specification\nRunasAlias     OP = root, operator\nRunasAlias     DB = oracle, sybase\nRunasAlias     ADMINGRP = adm, oper\n\n# Host alias specification\nHostAlias      SPARC = bigtime, eclipse, moet, anchor :\\\nSGI = grolsch, dandelion, black :\\\nALPHA = widget, thalamus, foobar :\\\nHPPA = boa, nag, python\nHostAlias      CUNETS = 128.138.0.0/255.255.0.0\nHostAlias      CSNETS = 128.138.243.0, 128.138.204.0/24, 128.138.242.0\nHostAlias      SERVERS = primary, mail, www, ns\nHostAlias      CDROM = orion, perseus, hercules\n\n# Cmnd alias specification\nCmndAlias      DUMPS = /usr/bin/mt, /usr/sbin/dump, /usr/sbin/rdump,\\\n/usr/sbin/restore, /usr/sbin/rrestore,\\\nsha224:0GomF8mNN3wlDt1HD9XldjJ3SNgpFdbjO1+NsQ== \\\n/home/operator/bin/startbackups\nCmndAlias      KILL = /usr/bin/kill\nCmndAlias      PRINTING = /usr/sbin/lpc, /usr/bin/lprm\nCmndAlias      SHUTDOWN = /usr/sbin/shutdown\nCmndAlias      HALT = /usr/sbin/halt\nCmndAlias      REBOOT = /usr/sbin/reboot\nCmndAlias      SHELLS = /usr/bin/sh, /usr/bin/csh, /usr/bin/ksh,\\\n/usr/local/bin/tcsh, /usr/bin/rsh,\\\n/usr/local/bin/zsh\nCmndAlias      SU = /usr/bin/su\nCmndAlias      PAGERS = /usr/bin/more, /usr/bin/pg, /usr/bin/less\n\nHere we override some of the compiled in default values.  We want sudo to log via syslog(3) us‐\ning the auth facility in all cases and for commands to be run with the target user's home di‐\nrectory as the working directory.  We don't want to subject the full time staff to the sudo\nlecture and we want to allow them to run commands in a chroot(2) “sandbox” via the -R option.\nUser millert need not provide a password and we don't want to reset the LOGNAME or USER envi‐\nronment variables when running commands as root.  Additionally, on the machines in the SERVERS\nHostAlias, we keep an additional local log file and make sure we log the year in each log line\nsince the log entries will be kept around for several years.  Lastly, we disable shell escapes\nfor the commands in the PAGERS CmndAlias (/usr/bin/more, /usr/bin/pg and /usr/bin/less).  Note\nthat this will not effectively constrain users with sudo ALL privileges.\n\n# Override built-in defaults\nDefaults                syslog=auth,runcwd=~\nDefaults>root           !setlogname\nDefaults:FULLTIMERS     !lecture,runchroot=*\nDefaults:millert        !authenticate\nDefaults@SERVERS        logyear, logfile=/var/log/sudo.log\nDefaults!PAGERS         noexec\n\nThe User specification is the part that actually determines who may run what.\n\nroot            ALL = (ALL) ALL\n%wheel          ALL = (ALL) ALL\n\nWe let root and any user in group wheel run any command on any host as any user.\n\nFULLTIMERS      ALL = NOPASSWD: ALL\n\nFull time sysadmins (millert, mikef, and dowdy) may run any command on any host without authen‐\nticating themselves.\n\nPARTTIMERS      ALL = ALL\n\nPart time sysadmins bostley, jwfox, and crawl) may run any command on any host but they must\nauthenticate themselves first (since the entry lacks the NOPASSWD tag).\n\njack            CSNETS = ALL\n\nThe user jack may run any command on the machines in the CSNETS alias (the networks\n128.138.243.0, 128.138.204.0, and 128.138.242.0).  Of those networks, only 128.138.204.0 has an\nexplicit netmask (in CIDR notation) indicating it is a class C network.  For the other networks\nin CSNETS, the local machine's netmask will be used during matching.\n\nlisa            CUNETS = ALL\n\nThe user lisa may run any command on any host in the CUNETS alias (the class B network\n128.138.0.0).\n\noperator        ALL = DUMPS, KILL, SHUTDOWN, HALT, REBOOT, PRINTING,\\\nsudoedit /etc/printcap, /usr/oper/bin/\n\nThe operator user may run commands limited to simple maintenance.  Here, those are commands re‐\nlated to backups, killing processes, the printing system, shutting down the system, and any\ncommands in the directory /usr/oper/bin/.  Note that one command in the DUMPS CmndAlias in‐\ncludes a sha224 digest, /home/operator/bin/startbackups.  This is because the directory con‐\ntaining the script is writable by the operator user.  If the script is modified (resulting in a\ndigest mismatch) it will no longer be possible to run it via sudo.\n\njoe             ALL = /usr/bin/su operator\n\nThe user joe may only su(1) to operator.\n\npete            HPPA = /usr/bin/passwd [A-Za-z]*, !/usr/bin/passwd *root*\n\n%opers          ALL = (: ADMINGRP) /usr/sbin/\n\nUsers in the opers group may run commands in /usr/sbin/ as themselves with any group in the\nADMINGRP RunasAlias (the adm and oper groups).\n\nThe user pete is allowed to change anyone's password except for root on the HPPA machines.  Be‐\ncause command line arguments are matched as a single, concatenated string, the ‘*’ wildcard\nwill match multiple words.  This example assumes that passwd(1) does not take multiple user\nnames on the command line.  Note that on GNU systems, options to passwd(1) may be specified af‐\nter the user argument.  As a result, this rule will also allow:\n\npasswd username --expire\n\nwhich may not be desirable.\n\nbob             SPARC = (OP) ALL : SGI = (OP) ALL\n\nThe user bob may run anything on the SPARC and SGI machines as any user listed in the OP\nRunasAlias (root and operator.)\n\njim             +biglab = ALL\n\nThe user jim may run any command on machines in the biglab netgroup.  sudo knows that “biglab”\nis a netgroup due to the ‘+’ prefix.\n\n+secretaries    ALL = PRINTING, /usr/bin/adduser, /usr/bin/rmuser\n\nUsers in the secretaries netgroup need to help manage the printers as well as add and remove\nusers, so they are allowed to run those commands on all machines.\n\nfred            ALL = (DB) NOPASSWD: ALL\n\nThe user fred can run commands as any user in the DB RunasAlias (oracle or sybase) without\ngiving a password.\n\njohn            ALPHA = /usr/bin/su [!-]*, !/usr/bin/su *root*\n\nOn the ALPHA machines, user john may su to anyone except root but he is not allowed to specify\nany options to the su(1) command.\n\njen             ALL, !SERVERS = ALL\n\nThe user jen may run any command on any machine except for those in the SERVERS HostAlias\n(primary, mail, www, and ns).\n\njill            SERVERS = /usr/bin/, !SU, !SHELLS\n\nFor any machine in the SERVERS HostAlias, jill may run any commands in the directory /usr/bin/\nexcept for those commands belonging to the SU and SHELLS CmndAliases.  While not specifically\nmentioned in the rule, the commands in the PAGERS CmndAlias all reside in /usr/bin and have\nthe noexec option set.\n\nsteve           CSNETS = (operator) /usr/local/opcommands/\n\nThe user steve may run any command in the directory /usr/local/opcommands/ but only as user\noperator.\n\nmatt            valkyrie = KILL\n\nOn his personal workstation, valkyrie, matt needs to be able to kill hung processes.\n\nWEBADMIN        www = (www) ALL, (root) /usr/bin/su www\n\nOn the host www, any user in the WEBADMIN UserAlias (will, wendy, and wim), may run any com‐\nmand as user www (which owns the web pages) or simply su(1) to www.\n\nALL             CDROM = NOPASSWD: /sbin/umount /CDROM,\\\n/sbin/mount -o nosuid\\,nodev /dev/cd0a /CDROM\n\nAny user may mount or unmount a CD-ROM on the machines in the CDROM HostAlias (orion, perseus,\nhercules) without entering a password.  This is a bit tedious for users to type, so it is a\nprime candidate for encapsulating in a shell script.\n",
            "subsections": []
        },
        "SECURITY NOTES": {
            "content": "Limitations of the ‘!’ operator\nIt is generally not effective to “subtract” commands from ALL using the ‘!’ operator.  A user\ncan trivially circumvent this by copying the desired command to a different name and then exe‐\ncuting that.  For example:\n\nbill    ALL = ALL, !SU, !SHELLS\n\nDoesn't really prevent bill from running the commands listed in SU or SHELLS since he can sim‐\nply copy those commands to a different name, or use a shell escape from an editor or other pro‐\ngram.  Therefore, these kind of restrictions should be considered advisory at best (and rein‐\nforced by policy).\n\nIn general, if a user has sudo ALL there is nothing to prevent them from creating their own\nprogram that gives them a root shell (or making their own copy of a shell) regardless of any\n‘!’ elements in the user specification.\n\nSecurity implications of fastglob\nIf the fastglob option is in use, it is not possible to reliably negate commands where the\npath name includes globbing (aka wildcard) characters.  This is because the C library's\nfnmatch(3) function cannot resolve relative paths.  While this is typically only an inconve‐\nnience for rules that grant privileges, it can result in a security issue for rules that sub‐\ntract or revoke privileges.\n\nFor example, given the following sudoers file entry:\n\njohn    ALL = /usr/bin/passwd [a-zA-Z0-9]*, /usr/bin/chsh [a-zA-Z0-9]*,\\\n/usr/bin/chfn [a-zA-Z0-9]*, !/usr/bin/* root\n\nUser john can still run /usr/bin/passwd root if fastglob is enabled by changing to /usr/bin\nand running ./passwd root instead.\n",
            "subsections": [
                {
                    "name": "Preventing shell escapes",
                    "content": "Once sudo executes a program, that program is free to do whatever it pleases, including run\nother programs.  This can be a security issue since it is not uncommon for a program to allow\nshell escapes, which lets a user bypass sudo's access control and logging.  Common programs\nthat permit shell escapes include shells (obviously), editors, paginators, mail, and terminal\nprograms.\n\nThere are four basic approaches to this problem:\n\nrestrict  Avoid giving users access to commands that allow the user to run arbitrary commands.\nMany editors have a restricted mode where shell escapes are disabled, though sudoedit\nis a better solution to running editors via sudo.  Due to the large number of pro‐\ngrams that offer shell escapes, restricting users to the set of programs that do not\nis often unworkable.\n\nintercept\nMany systems that support shared libraries have the ability to override default li‐\nbrary functions by pointing an environment variable (usually LDPRELOAD) to an alter‐\nnate shared library.  On such systems, sudo's intercept functionality can be used to\ntransparently intercept an attempt to run a new command, allow or deny it based on\nsudoers rules, and log the result.  For example, this can be used to restrict the\ncommands run from within a privileged shell.  Note, however, that this applies only\nto dynamically-linked executables.  Statically-linked executables and executables\nrunning under binary emulation are not affected.  Also, most shells support built-in\ncommands and the ability to read or write sensitive files that cannot be intercepted\nby sudo.\n\nCurrently, sudo's intercept functionality only works for programs that use the\nexecl(), execle(), execlp(), execv(), execve(), execvp(), or execvpe() library func‐\ntions to run the new command.  This may be expanded in a future release of sudo.  Be‐\ncause most dynamic loaders ignore LDPRELOAD (or the equivalent) when running set-\nuser-ID and set-group-ID programs, sudoers will not permit such programs to be run in\nintercept mode.\n\nThe intercept feature is known to work on Solaris, *BSD, Linux, macOS, HP-UX 11.x and\nAIX 5.3 and above.  It should be supported on most operating systems that support the\nLDPRELOAD environment variable.  Check your operating system's manual pages for the\ndynamic linker (usually ld.so, ld.so.1, dyld, dld.sl, rld, or loader) to see if\nLDPRELOAD is supported.  It is not supported when sudo's SELinux RBAC support is in\nuse due to a fundamental incompatibility.\n\nTo enable intercept mode on a per-command basis, use the INTERCEPT tag as documented\nin the User Specification section above.  Here is that example again:\n\nchuck   research = INTERCEPT: ALL\n\nThis allows user chuck to run any command on the machine “research” in intercept\nmode.  Any commands run via shell escapes will be validated and logged by sudo.  If\nyou are unsure whether or not your system is capable of supporting intercept, you can\nalways just try it out and check whether or not external commands run via a shell are\nlogged when intercept is enabled.\n\nlog       There are two separate but related ways to log additional commands.  The first is to\nenable I/O logging using the logoutput flag.  This will log the command's output but\nwill not create an event log entry when the additional command is run.  The second is\nto enable the logsubcmds flag in sudoers which will create an event log entry every\ntime a new command is run.  If I/O logging is also enabled, the log entry will in‐\nclude a time offset into the I/O log to indicate when the command was run.  This off‐\nset can be passed to the sudoreplay(8) utility to replay the I/O log at the exact mo‐\nment when the command was run.  The logsubcmds flag uses the same mechanism as\nintercept (see above) and has the same limitations.\n\nnoexec    sudo's noexec functionality can be used to prevent a program run by sudo from execut‐\ning any other programs.  On most systems, it uses the same mechanism as intercept\n(see above) and thus the same caveats apply.  The noexec functionality is capable of\nblocking execution of commands run via the execl(), execle(), execlp(), exect(),\nexecv(), execve(), execveat(), execvP(), execvp(), execvpe(), fexecve(), popen(),\nposixspawn(), posixspawnp(), system(), and wordexp() functions.  On Linux, a\nseccomp() filter is used to implement noexec.  On Solaris 10 and higher, noexec uses\nSolaris privileges instead of the LDPRELOAD environment variable.\n\nTo enable noexec for a command, use the NOEXEC tag as documented in the User Specifi‐\ncation section above.  Here is that example again:\n\naaron   shanty = NOEXEC: /usr/bin/more, /usr/bin/vi\n\nThis allows user aaron to run /usr/bin/more and /usr/bin/vi with noexec enabled.\nThis will prevent those two commands from executing other commands (such as a shell).\nIf you are unsure whether or not your system is capable of supporting noexec you can\nalways just try it out and check whether shell escapes work when noexec is enabled.\n\nNote that restricting shell escapes is not a panacea.  Programs running as root are still capa‐\nble of many potentially hazardous operations (such as changing or overwriting files) that could\nlead to unintended privilege escalation.  In the specific case of an editor, a safer approach\nis to give the user permission to run sudoedit (see below).\n"
                },
                {
                    "name": "Secure editing",
                    "content": "The sudoers plugin includes sudoedit support which allows users to securely edit files with the\neditor of their choice.  As sudoedit is a built-in command, it must be specified in the sudoers\nfile without a leading path.  However, it may take command line arguments just as a normal com‐\nmand does.  Wildcards used in sudoedit command line arguments are expected to be path names, so\na forward slash (‘/’) will not be matched by a wildcard.\n\nUnlike other sudo commands, the editor is run with the permissions of the invoking user and\nwith the environment unmodified.  More information may be found in the description of the -e\noption in sudo(8).\n\nFor example, to allow user operator to edit the “message of the day” file:\n\noperator        sudoedit /etc/motd\n\nThe operator user then runs sudoedit as follows:\n\n$ sudoedit /etc/motd\n\nThe editor will run as the operator user, not root, on a temporary copy of /etc/motd.  After\nthe file has been edited, /etc/motd will be updated with the contents of the temporary copy.\n\nUsers should never be granted sudoedit permission to edit a file that resides in a directory\nthe user has write access to, either directly or via a wildcard.  If the user has write access\nto the directory it is possible to replace the legitimate file with a link to another file, al‐\nlowing the editing of arbitrary files.  To prevent this, starting with version 1.8.16, symbolic\nlinks will not be followed in writable directories and sudoedit will refuse to edit a file lo‐\ncated in a writable directory unless the sudoeditcheckdir option has been disabled or the in‐\nvoking user is root.  Additionally, in version 1.8.15 and higher, sudoedit will refuse to open\na symbolic link unless either the sudoeditfollow option is enabled or the sudoedit command is\nprefixed with the FOLLOW tag in the sudoers file.\n"
                },
                {
                    "name": "Time stamp file checks",
                    "content": "sudoers will check the ownership of its time stamp directory (/run/sudo/ts by default) and ig‐\nnore the directory's contents if it is not owned by root or if it is writable by a user other\nthan root.  Older versions of sudo stored time stamp files in /tmp; this is no longer recom‐\nmended as it may be possible for a user to create the time stamp themselves on systems that al‐\nlow unprivileged users to change the ownership of files they create.\n\nWhile the time stamp directory should be cleared at reboot time, not all systems contain a /run\nor /var/run directory.  To avoid potential problems, sudoers will ignore time stamp files that\ndate from before the machine booted on systems where the boot time is available.\n\nSome systems with graphical desktop environments allow unprivileged users to change the system\nclock.  Since sudoers relies on the system clock for time stamp validation, it may be possible\non such systems for a user to run sudo for longer than timestamptimeout by setting the clock\nback.  To combat this, sudoers uses a monotonic clock (which never moves backwards) for its\ntime stamps if the system supports it.\n\nsudoers will not honor time stamps set far in the future.  Time stamps with a date greater than\ncurrenttime + 2 * TIMEOUT will be ignored and sudoers will log and complain.\n\nIf the timestamptype option is set to “tty”, the time stamp record includes the device number\nof the terminal the user authenticated with.  This provides per-terminal granularity but time\nstamp records may still outlive the user's session.\n\nUnless the timestamptype option is set to “global”, the time stamp record also includes the\nsession ID of the process that last authenticated.  This prevents processes in different termi‐\nnal sessions from using the same time stamp record.  On systems where a process's start time\ncan be queried, the start time of the session leader is recorded in the time stamp record.  If\nno terminal is present or the timestamptype option is set to “ppid”, the start time of the\nparent process is used instead.  In most cases this will prevent a time stamp record from being\nre-used without the user entering a password when logging out and back in again.\n"
                }
            ]
        },
        "DEBUGGING": {
            "content": "Versions 1.8.4 and higher of the sudoers plugin support a flexible debugging framework that can\nhelp track down what the plugin is doing internally if there is a problem.  This can be config‐\nured in the sudo.conf(5) file.\n\nThe sudoers plugin uses the same debug flag format as the sudo front-end: subsystem@priority.\n\nThe priorities used by sudoers, in order of decreasing severity, are: crit, err, warn, notice,\ndiag, info, trace, and debug.  Each priority, when specified, also includes all priorities\nhigher than it.  For example, a priority of notice would include debug messages logged at\nnotice and higher.\n\nThe following subsystems are used by the sudoers plugin:\n\nalias     UserAlias, RunasAlias, HostAlias and CmndAlias processing\n\nall       matches every subsystem\n\naudit     BSM and Linux audit code\n\nauth      user authentication\n\ndefaults  sudoers file Defaults settings\n\nenv       environment handling\n\nldap      LDAP-based sudoers\n\nlogging   logging support\n\nmatch     matching of users, groups, hosts, and netgroups in the sudoers file\n\nnetif     network interface handling\n\nnss       network service switch handling in sudoers\n\nparser    sudoers file parsing\n\nperms     permission setting\n\nplugin    The equivalent of main for the plugin.\n\npty       pseudo-terminal related code\n\nrbtree    redblack tree internals\n\nsssd      SSSD-based sudoers\n\nutil      utility functions\n\nFor example:\n\nDebug sudoers.so /var/log/sudoersdebug match@info,nss@info\n\nFor more information, see the sudo.conf(5) manual.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "ssh(1), su(1), fnmatch(3), glob(3), mktemp(3), strftime(3), sudo.conf(5), sudoplugin(5),\nsudoers.ldap(5), sudoerstimestamp(5), sudo(8), visudo(8)\n",
            "subsections": []
        },
        "AUTHORS": {
            "content": "Many people have worked on sudo over the years; this version consists of code written primarily\nby:\n\nTodd C. Miller\n\nSee the CONTRIBUTORS file in the sudo distribution (https://www.sudo.ws/contributors.html) for\nan exhaustive list of people who have contributed to sudo.\n",
            "subsections": []
        },
        "CAVEATS": {
            "content": "The sudoers file should always be edited by the visudo utility which locks the file and checks\nfor syntax errors.  If sudoers contains syntax errors, sudo may refuse to run, which is a seri‐\nous problem if sudo is your only method of obtaining superuser privileges.  Recent versions of\nsudoers will attempt to recover after a syntax error by ignoring the rest of the line after en‐\ncountering an error.  Older versions of sudo will not run if sudoers contains a syntax error.\n\nWhen using netgroups of machines (as opposed to users), if you store fully qualified host name\nin the netgroup (as is usually the case), you either need to have the machine's host name be\nfully qualified as returned by the hostname command or use the fqdn option in sudoers.\n",
            "subsections": []
        },
        "BUGS": {
            "content": "If you feel you have found a bug in sudo, please submit a bug report at\nhttps://bugzilla.sudo.ws/\n",
            "subsections": []
        },
        "SUPPORT": {
            "content": "Limited free support is available via the sudo-users mailing list, see\nhttps://www.sudo.ws/mailman/listinfo/sudo-users to subscribe or search the archives.\n",
            "subsections": []
        },
        "DISCLAIMER": {
            "content": "sudo is provided “AS IS” and any express or implied warranties, including, but not limited to,\nthe implied warranties of merchantability and fitness for a particular purpose are disclaimed.\nSee the LICENSE file distributed with sudo or https://www.sudo.ws/license.html for complete de‐\ntails.\n",
            "subsections": []
        },
        "Sudo 1.9.9                     January 20, 2022                     Sudo 1.9.9": {
            "content": "",
            "subsections": []
        }
    },
    "summary": "sudoers — default sudo security policy plugin",
    "flags": [],
    "examples": [
        "Below are example sudoers file entries.  Admittedly, some of these are a bit contrived.  First,",
        "we allow a few environment variables to pass and then define our aliases:",
        "# 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 envkeep += \"DISPLAY HOME\"",
        "# User alias specification",
        "UserAlias      FULLTIMERS = millert, mikef, dowdy",
        "UserAlias      PARTTIMERS = bostley, jwfox, crawl",
        "UserAlias      WEBADMIN = will, wendy, wim",
        "# Runas alias specification",
        "RunasAlias     OP = root, operator",
        "RunasAlias     DB = oracle, sybase",
        "RunasAlias     ADMINGRP = adm, oper",
        "# Host alias specification",
        "HostAlias      SPARC = bigtime, eclipse, moet, anchor :\\",
        "SGI = grolsch, dandelion, black :\\",
        "ALPHA = widget, thalamus, foobar :\\",
        "HPPA = boa, nag, python",
        "HostAlias      CUNETS = 128.138.0.0/255.255.0.0",
        "HostAlias      CSNETS = 128.138.243.0, 128.138.204.0/24, 128.138.242.0",
        "HostAlias      SERVERS = primary, mail, www, ns",
        "HostAlias      CDROM = orion, perseus, hercules",
        "# Cmnd alias specification",
        "CmndAlias      DUMPS = /usr/bin/mt, /usr/sbin/dump, /usr/sbin/rdump,\\",
        "/usr/sbin/restore, /usr/sbin/rrestore,\\",
        "sha224:0GomF8mNN3wlDt1HD9XldjJ3SNgpFdbjO1+NsQ== \\",
        "/home/operator/bin/startbackups",
        "CmndAlias      KILL = /usr/bin/kill",
        "CmndAlias      PRINTING = /usr/sbin/lpc, /usr/bin/lprm",
        "CmndAlias      SHUTDOWN = /usr/sbin/shutdown",
        "CmndAlias      HALT = /usr/sbin/halt",
        "CmndAlias      REBOOT = /usr/sbin/reboot",
        "CmndAlias      SHELLS = /usr/bin/sh, /usr/bin/csh, /usr/bin/ksh,\\",
        "/usr/local/bin/tcsh, /usr/bin/rsh,\\",
        "/usr/local/bin/zsh",
        "CmndAlias      SU = /usr/bin/su",
        "CmndAlias      PAGERS = /usr/bin/more, /usr/bin/pg, /usr/bin/less",
        "Here we override some of the compiled in default values.  We want sudo to log via syslog(3) us‐",
        "ing the auth facility in all cases and for commands to be run with the target user's home di‐",
        "rectory as the working directory.  We don't want to subject the full time staff to the sudo",
        "lecture and we want to allow them to run commands in a chroot(2) “sandbox” via the -R option.",
        "User millert need not provide a password and we don't want to reset the LOGNAME or USER envi‐",
        "ronment variables when running commands as root.  Additionally, on the machines in the SERVERS",
        "HostAlias, we keep an additional local log file and make sure we log the year in each log line",
        "since the log entries will be kept around for several years.  Lastly, we disable shell escapes",
        "for the commands in the PAGERS CmndAlias (/usr/bin/more, /usr/bin/pg and /usr/bin/less).  Note",
        "that this will not effectively constrain users with sudo ALL privileges.",
        "# Override built-in defaults",
        "Defaults                syslog=auth,runcwd=~",
        "Defaults>root           !setlogname",
        "Defaults:FULLTIMERS     !lecture,runchroot=*",
        "Defaults:millert        !authenticate",
        "Defaults@SERVERS        logyear, logfile=/var/log/sudo.log",
        "Defaults!PAGERS         noexec",
        "The User specification is the part that actually determines who may run what.",
        "root            ALL = (ALL) ALL",
        "%wheel          ALL = (ALL) ALL",
        "We let root and any user in group wheel run any command on any host as any user.",
        "FULLTIMERS      ALL = NOPASSWD: ALL",
        "Full time sysadmins (millert, mikef, and dowdy) may run any command on any host without authen‐",
        "ticating themselves.",
        "PARTTIMERS      ALL = ALL",
        "Part time sysadmins bostley, jwfox, and crawl) may run any command on any host but they must",
        "authenticate themselves first (since the entry lacks the NOPASSWD tag).",
        "jack            CSNETS = ALL",
        "The user jack may run any command on the machines in the CSNETS alias (the networks",
        "128.138.243.0, 128.138.204.0, and 128.138.242.0).  Of those networks, only 128.138.204.0 has an",
        "explicit netmask (in CIDR notation) indicating it is a class C network.  For the other networks",
        "in CSNETS, the local machine's netmask will be used during matching.",
        "lisa            CUNETS = ALL",
        "The user lisa may run any command on any host in the CUNETS alias (the class B network",
        "128.138.0.0).",
        "operator        ALL = DUMPS, KILL, SHUTDOWN, HALT, REBOOT, PRINTING,\\",
        "sudoedit /etc/printcap, /usr/oper/bin/",
        "The operator user may run commands limited to simple maintenance.  Here, those are commands re‐",
        "lated to backups, killing processes, the printing system, shutting down the system, and any",
        "commands in the directory /usr/oper/bin/.  Note that one command in the DUMPS CmndAlias in‐",
        "cludes a sha224 digest, /home/operator/bin/startbackups.  This is because the directory con‐",
        "taining the script is writable by the operator user.  If the script is modified (resulting in a",
        "digest mismatch) it will no longer be possible to run it via sudo.",
        "joe             ALL = /usr/bin/su operator",
        "The user joe may only su(1) to operator.",
        "pete            HPPA = /usr/bin/passwd [A-Za-z]*, !/usr/bin/passwd *root*",
        "%opers          ALL = (: ADMINGRP) /usr/sbin/",
        "Users in the opers group may run commands in /usr/sbin/ as themselves with any group in the",
        "ADMINGRP RunasAlias (the adm and oper groups).",
        "The user pete is allowed to change anyone's password except for root on the HPPA machines.  Be‐",
        "cause command line arguments are matched as a single, concatenated string, the ‘*’ wildcard",
        "will match multiple words.  This example assumes that passwd(1) does not take multiple user",
        "names on the command line.  Note that on GNU systems, options to passwd(1) may be specified af‐",
        "ter the user argument.  As a result, this rule will also allow:",
        "passwd username --expire",
        "which may not be desirable.",
        "bob             SPARC = (OP) ALL : SGI = (OP) ALL",
        "The user bob may run anything on the SPARC and SGI machines as any user listed in the OP",
        "RunasAlias (root and operator.)",
        "jim             +biglab = ALL",
        "The user jim may run any command on machines in the biglab netgroup.  sudo knows that “biglab”",
        "is a netgroup due to the ‘+’ prefix.",
        "+secretaries    ALL = PRINTING, /usr/bin/adduser, /usr/bin/rmuser",
        "Users in the secretaries netgroup need to help manage the printers as well as add and remove",
        "users, so they are allowed to run those commands on all machines.",
        "fred            ALL = (DB) NOPASSWD: ALL",
        "The user fred can run commands as any user in the DB RunasAlias (oracle or sybase) without",
        "giving a password.",
        "john            ALPHA = /usr/bin/su [!-]*, !/usr/bin/su *root*",
        "On the ALPHA machines, user john may su to anyone except root but he is not allowed to specify",
        "any options to the su(1) command.",
        "jen             ALL, !SERVERS = ALL",
        "The user jen may run any command on any machine except for those in the SERVERS HostAlias",
        "(primary, mail, www, and ns).",
        "jill            SERVERS = /usr/bin/, !SU, !SHELLS",
        "For any machine in the SERVERS HostAlias, jill may run any commands in the directory /usr/bin/",
        "except for those commands belonging to the SU and SHELLS CmndAliases.  While not specifically",
        "mentioned in the rule, the commands in the PAGERS CmndAlias all reside in /usr/bin and have",
        "the noexec option set.",
        "steve           CSNETS = (operator) /usr/local/opcommands/",
        "The user steve may run any command in the directory /usr/local/opcommands/ but only as user",
        "operator.",
        "matt            valkyrie = KILL",
        "On his personal workstation, valkyrie, matt needs to be able to kill hung processes.",
        "WEBADMIN        www = (www) ALL, (root) /usr/bin/su www",
        "On the host www, any user in the WEBADMIN UserAlias (will, wendy, and wim), may run any com‐",
        "mand as user www (which owns the web pages) or simply su(1) to www.",
        "ALL             CDROM = NOPASSWD: /sbin/umount /CDROM,\\",
        "/sbin/mount -o nosuid\\,nodev /dev/cd0a /CDROM",
        "Any user may mount or unmount a CD-ROM on the machines in the CDROM HostAlias (orion, perseus,",
        "hercules) without entering a password.  This is a bit tedious for users to type, so it is a",
        "prime candidate for encapsulating in a shell script."
    ],
    "see_also": [
        {
            "name": "ssh",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/ssh/1/json"
        },
        {
            "name": "su",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/su/1/json"
        },
        {
            "name": "fnmatch",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/fnmatch/3/json"
        },
        {
            "name": "glob",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/glob/3/json"
        },
        {
            "name": "mktemp",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/mktemp/3/json"
        },
        {
            "name": "strftime",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/strftime/3/json"
        },
        {
            "name": "sudo.conf",
            "section": "5",
            "url": "https://www.chedong.com/phpMan.php/man/sudo.conf/5/json"
        },
        {
            "name": "sudoplugin",
            "section": "5",
            "url": "https://www.chedong.com/phpMan.php/man/sudoplugin/5/json"
        },
        {
            "name": "sudoers.ldap",
            "section": "5",
            "url": "https://www.chedong.com/phpMan.php/man/sudoers.ldap/5/json"
        },
        {
            "name": "sudoerstimestamp",
            "section": "5",
            "url": "https://www.chedong.com/phpMan.php/man/sudoerstimestamp/5/json"
        },
        {
            "name": "sudo",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/sudo/8/json"
        },
        {
            "name": "visudo",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/visudo/8/json"
        }
    ]
}