1VISUDO(8)                    MAINTENANCE COMMANDS                    VISUDO(8)
2
3
4

NAME

6       visudo - edit the sudoers file
7

SYNOPSIS

9       visudo [ -c ] [ -f sudoers ] [ -q ] [ -s ] [ -V ]
10

DESCRIPTION

12       visudo edits the sudoers file in a safe fashion, analogous to vipw(8).
13       visudo locks the sudoers file against multiple simultaneous edits, pro‐
14       vides basic sanity checks, and checks for parse errors.  If the sudoers
15       file is currently being edited you will receive a message to try again
16       later.
17
18       There is a hard-coded list of editors that visudo will use set at com‐
19       pile-time that may be overridden via the editor sudoers Default vari‐
20       able.  This list defaults to the path to vi(1) on your system, as
21       determined by the configure script.  Normally, visudo does not honor
22       the VISUAL or EDITOR environment variables unless they contain an edi‐
23       tor in the aforementioned editors list.  However, if visudo is config‐
24       ured with the --with-enveditor flag or the enveditor Default variable
25       is set in sudoers, visudo will use any the editor defines by VISUAL or
26       EDITOR.  Note that this can be a security hole since it allows the user
27       to execute any program they wish simply by setting VISUAL or EDITOR.
28
29       visudo parses the sudoers file after the edit and will not save the
30       changes if there is a syntax error.  Upon finding an error, visudo will
31       print a message stating the line number(s) where the error occurred and
32       the user will receive the "What now?" prompt.  At this point the user
33       may enter "e" to re-edit the sudoers file, "x" to exit without saving
34       the changes, or "Q" to quit and save changes.  The "Q" option should be
35       used with extreme care because if visudo believes there to be a parse
36       error, so will sudo and no one will be able to sudo again until the
37       error is fixed.  If "e" is typed to edit the  sudoers file after a
38       parse error has been detected, the cursor will be placed on the line
39       where the error occurred (if the editor supports this feature).
40

OPTIONS

42       visudo accepts the following command line options:
43
44       -c  Enable check-only mode.  The existing sudoers file will be checked
45           for syntax and a message will be printed to the standard output
46           detailing the status of sudoers.  If the syntax check completes
47           successfully, visudo will exit with a value of 0.  If a syntax
48           error is encountered, visudo will exit with a value of 1.
49
50       -f  Specify and alternate sudoers file location.  With this option
51           visudo will edit (or check) the sudoers file of your choice,
52           instead of the default, /etc/sudoers.  The lock file used is the
53           specified sudoers file with ".tmp" appended to it.
54
55       -q  Enable quiet mode.  In this mode details about syntax errors are
56           not printed.  This option is only useful when combined with the -c
57           flag.
58
59       -s  Enable strict checking of the sudoers file.  If an alias is used
60           before it is defined, visudo will consider this a parse error.
61           Note that it is not possible to differentiate between an alias and
62           a hostname or username that consists solely of uppercase letters,
63           digits, and the underscore ('_') character.
64
65       -V  The -V (version) option causes visudo to print its version number
66           and exit.
67

ENVIRONMENT

69       The following environment variables are used only if visudo was config‐
70       ured with the --with-env-editor option:
71
72        VISUAL                 Invoked by visudo as the editor to use
73        EDITOR                 Used by visudo if VISUAL is not set
74

FILES

76        /etc/sudoers           List of who can run what
77        /etc/sudoers.tmp       Lock file for visudo
78

DIAGNOSTICS

80       sudoers file busy, try again later.
81           Someone else is currently editing the sudoers file.
82
83       /etc/sudoers.tmp: Permission denied
84           You didn't run visudo as root.
85
86       Can't find you in the passwd database
87           Your userid does not appear in the system passwd file.
88
89       Warning: undeclared Alias referenced near ...
90           Either you are using a {User,Runas,Host,Cmnd}_Alias before defining
91           it or you have a user or hostname listed that consists solely of
92           uppercase letters, digits, and the underscore ('_') character.  If
93           the latter, you can ignore the warnings (sudo will not complain).
94           In -s (strict) mode these are errors, not warnings.
95
96       Warning: runas_default set after old value is in use ...
97           You have a runas_default Defaults setting listed in the sudoers
98           file after its value has already been used.  This means that
99           entries prior to the runas_default setting will match based on the
100           default value of runas_default (root) whereas entries after the
101           runas_default setting will match based on the new value.  This is
102           usually unintentional and in most cases the <runas_default> setting
103           should be placed before any Runas_Alias or User specifications.  In
104           -s (strict) mode this is an error, not a warning.
105

SEE ALSO

107       vi(1), sudoers(5), sudo(8), vipw(8)
108

AUTHOR

110       Many people have worked on sudo over the years; this version of visudo
111       was written by:
112
113        Todd Miller
114
115       See the HISTORY file in the sudo distribution or visit
116       http://www.sudo.ws/sudo/history.html for more details.
117

CAVEATS

119       There is no easy way to prevent a user from gaining a root shell if the
120       editor used by visudo allows shell escapes.
121

BUGS

123       If you feel you have found a bug in visudo, please submit a bug report
124       at http://www.sudo.ws/sudo/bugs/
125

SUPPORT

127       Commercial support is available for sudo, see
128       http://www.sudo.ws/sudo/support.html for details.
129
130       Limited free support is available via the sudo-users mailing list, see
131       http://www.sudo.ws/mailman/listinfo/sudo-users to subscribe or search
132       the archives.
133

DISCLAIMER

135       Visudo is provided ``AS IS'' and any express or implied warranties,
136       including, but not limited to, the implied warranties of merchantabil‐
137       ity and fitness for a particular purpose are disclaimed.  See the
138       LICENSE file distributed with sudo or
139       http://www.sudo.ws/sudo/license.html for complete details.
140
141
142
1431.6.8p12                         June 20, 2005                       VISUDO(8)
Impressum