1VISUDO(8) MAINTENANCE COMMANDS VISUDO(8)
2
3
4
6 visudo - edit the sudoers file
7
9 visudo [-c] [-q] [-s] [-V] [-f sudoers]
10
12 visudo edits the sudoers file in a safe fashion, analogous to vipw(8).
13 visudo locks the sudoers file against multiple simultaneous edits,
14 provides basic sanity checks, and checks for parse errors. If the
15 sudoers file is currently being edited you will receive a message to
16 try again later.
17
18 There is a hard-coded list of one or more editors that visudo will use
19 set at compile-time that may be overridden via the editor sudoers
20 Default variable. This list defaults to "/bin/vi". Normally, visudo
21 does not honor the VISUAL or EDITOR environment variables unless they
22 contain an editor in the aforementioned editors list. However, if
23 visudo is configured with the --with-env-editor option or the
24 env_editor Default variable is set in sudoers, visudo will use any the
25 editor defines by VISUAL or EDITOR. Note that this can be a security
26 hole since it allows the user to execute any program they wish simply
27 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
42 visudo accepts the following command line options:
43
44 -c Enable check-only mode. The existing sudoers file will be
45 checked for syntax and a message will be printed to the
46 standard output detailing the status of sudoers. If the
47 syntax check completes successfully, visudo will exit with
48 a value of 0. If a syntax error is encountered, visudo
49 will exit with a value of 1.
50
51 -f sudoers Specify and alternate sudoers file location. With this
52 option visudo will edit (or check) the sudoers file of your
53 choice, instead of the default, /etc/sudoers. The lock
54 file used is the specified sudoers file with ".tmp"
55 appended to it.
56
57 -q Enable quiet mode. In this mode details about syntax
58 errors are not printed. This option is only useful when
59 combined with the -c option.
60
61 -s Enable strict checking of the sudoers file. If an alias is
62 used before it is defined, visudo will consider this a
63 parse error. Note that it is not possible to differentiate
64 between an alias and a host name or user name that consists
65 solely of uppercase letters, digits, and the underscore
66 ('_') character.
67
68 -V The -V (version) option causes visudo to print its version
69 number and exit.
70
72 The following environment variables may be consulted depending on the
73 value of the editor and env_editor sudoers variables:
74
75 VISUAL Invoked by visudo as the editor to use
76
77 EDITOR Used by visudo if VISUAL is not set
78
80 /etc/sudoers List of who can run what
81
82 /etc/sudoers.tmp Lock file for visudo
83
85 sudoers file busy, try again later.
86 Someone else is currently editing the sudoers file.
87
88 /etc/sudoers.tmp: Permission denied
89 You didn't run visudo as root.
90
91 Can't find you in the passwd database
92 Your userid does not appear in the system passwd file.
93
94 Warning: {User,Runas,Host,Cmnd}_Alias referenced but not defined
95 Either you are trying to use an undeclare
96 {User,Runas,Host,Cmnd}_Alias or you have a user or host name listed
97 that consists solely of uppercase letters, digits, and the
98 underscore ('_') character. In the latter case, you can ignore the
99 warnings (sudo will not complain). In -s (strict) mode these are
100 errors, not warnings.
101
102 Warning: unused {User,Runas,Host,Cmnd}_Alias
103 The specified {User,Runas,Host,Cmnd}_Alias was defined but never
104 used. You may wish to comment out or remove the unused alias. In
105 -s (strict) mode this is an error, not a warning.
106
108 vi(1), sudoers(5), sudo(8), vipw(8)
109
111 Many people have worked on sudo over the years; this version of visudo
112 was written by:
113
114 Todd Miller
115
116 See the HISTORY file in the sudo distribution or visit
117 http://www.sudo.ws/sudo/history.html for more details.
118
120 There is no easy way to prevent a user from gaining a root shell if the
121 editor used by visudo allows shell escapes.
122
124 If you feel you have found a bug in visudo, please submit a bug report
125 at http://www.sudo.ws/sudo/bugs/
126
128 Limited free support is available via the sudo-users mailing list, see
129 http://www.sudo.ws/mailman/listinfo/sudo-users to subscribe or search
130 the archives.
131
133 visudo is provided ``AS IS'' and any express or implied warranties,
134 including, but not limited to, the implied warranties of
135 merchantability and fitness for a particular purpose are disclaimed.
136 See the LICENSE file distributed with sudo or
137 http://www.sudo.ws/sudo/license.html for complete details.
138
139
140
1411.7.4 July 14, 2010 VISUDO(8)