-
-
Notifications
You must be signed in to change notification settings - Fork 280
Expand file tree
/
Copy pathsudoers.man.in
More file actions
8166 lines (8125 loc) · 189 KB
/
sudoers.man.in
File metadata and controls
8166 lines (8125 loc) · 189 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
.\" Automatically generated from the sudoers.mdoc.in file. Do not edit.
.\"
.\" SPDX-License-Identifier: ISC
.\"
.\" Copyright (c) 1994-1996, 1998-2005, 2007-2025
.\" Todd C. Miller <[email protected]>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.\" Sponsored in part by the Defense Advanced Research Projects
.\" Agency (DARPA) and Air Force Research Laboratory, Air Force
.\" Materiel Command, USAF, under agreement number F39502-99-1-0512.
.\"
.nr SL @SEMAN@
.nr AA @AAMAN@
.nr BA @BAMAN@
.nr LC @LCMAN@
.nr PS @PSMAN@
.TH "SUDOERS" "@mansectform@" "October 25, 2025" "Sudo @PACKAGE_VERSION@" "File Formats Manual"
.nh
.if n .ad l
.SH "NAME"
\fBsudoers\fR
\- default sudo security policy plugin
.SH "DESCRIPTION"
The
\fBsudoers\fR
policy plugin determines a user's
\fBsudo\fR
privileges.
It is the default
\fBsudo\fR
policy plugin.
The policy is driven by
the
\fI@sysconfdir@/sudoers\fR
file or, optionally, in LDAP.
The policy format is described in detail in the
\fISUDOERS FILE FORMAT\fR
section.
For information on storing
\fBsudoers\fR
policy information
in LDAP, see
sudoers.ldap(@mansectform@).
.SS "Configuring sudo.conf for sudoers"
\fBsudo\fR
consults the
sudo.conf(@mansectform@)
file to determine which plugins to load.
If no
sudo.conf(@mansectform@)
file is present, or if it contains no
\fIPlugin\fR
lines,
\fBsudoers\fR
will be used for auditing, policy decisions and I/O logging.
To explicitly configure
sudo.conf(@mansectform@)
to use the
\fBsudoers\fR
plugin, the following configuration can be used.
.nf
.sp
.RS 4n
Plugin sudoers_audit @sudoers_plugin@
Plugin sudoers_policy @sudoers_plugin@
Plugin sudoers_io @sudoers_plugin@
.RE
.fi
.PP
Starting with
\fBsudo\fR
1.8.5, it is possible to specify optional arguments to the
\fBsudoers\fR
plugin in the
sudo.conf(@mansectform@)
file.
Plugin arguments, if any, should be listed after the path to the plugin
(i.e., after
\fI@sudoers_plugin@\fR).
The arguments are only effective for the plugin that opens (and parses) the
\fIsudoers\fR
file.
.PP
For
\fBsudo\fR
version 1.9.1 and higher, this is the
\fIsudoers_audit\fR
plugin.
For older versions, it is the
\fIsudoers_policy\fR
plugin.
Multiple arguments may be specified, separated by white space.
For example:
.nf
.sp
.RS 4n
Plugin sudoers_audit @sudoers_plugin@ sudoers_mode=0400 error_recovery=false
.RE
.fi
.PP
The following plugin arguments are supported:
.TP 6n
error_recovery=bool
The
\fIerror_recovery\fR
argument can be used to control whether
\fBsudoers\fR
should attempt to recover from syntax errors in the
\fIsudoers\fR
file.
If set to
\fItrue\fR
(the default),
\fBsudoers\fR
will try to recover from a syntax error by discarding the portion
of the line that contains the error until the end of the line.
A value of
\fIfalse\fR
will disable error recovery.
Prior to version 1.9.3, no error recovery was performed.
.TP 6n
ignore_perms=bool
The
\fIignore_perms\fR
argument can be used to disable security checks when loading the
\fIsudoers\fR
file.
If enabled, the
\fIsudoers\fR
file will be loaded regardless of the owner or file mode.
This argument is intended to be used for testing purposes and
should not be enabled on production systems.
.TP 6n
ldap_conf=pathname
The
\fIldap_conf\fR
argument can be used to override the default path to the
\fIldap.conf\fR
file.
.TP 6n
ldap_secret=pathname
The
\fIldap_secret\fR
argument can be used to override the default path to the
\fIldap.secret\fR
file.
.TP 6n
sudoers_file=pathname
The
\fIsudoers_file\fR
argument can be used to override the default path to the
\fIsudoers\fR
file.
.TP 6n
sudoers_uid=user-ID
The
\fIsudoers_uid\fR
argument can be used to override the default owner of the sudoers file.
It should be specified as a numeric user-ID.
.TP 6n
sudoers_gid=group-ID
The
\fIsudoers_gid\fR
argument can be used to override the default group of the sudoers file.
It must be specified as a numeric group-ID (not a group name).
.TP 6n
sudoers_mode=mode
The
\fIsudoers_mode\fR
argument can be used to override the default file mode for the sudoers file.
It should be specified as an octal value.
.PP
For more information on configuring
sudo.conf(@mansectform@),
refer to its manual.
.SS "User Authentication"
The
\fBsudoers\fR
security policy requires that most users authenticate
themselves before they can use
\fBsudo\fR.
A password is not required
if the invoking user is
\fBroot\fR,
if the target user is the same as the invoking user, or if the
policy has disabled authentication for the user or command.
Unlike
su(1),
when
\fBsudoers\fR
requires
authentication, it validates the invoking user's credentials, not
the target user's (or
\fB@runas_default@\fR's)
credentials.
This can be changed via
the
\fIrootpw\fR,
\fItargetpw\fR
and
\fIrunaspw\fR
flags, described later.
.PP
If a user who is not listed in the policy tries to run a command
via
\fBsudo\fR,
mail is sent to the proper authorities.
The address
used for such mail is configurable via the
\fImailto\fR
Defaults entry
(described later) and defaults to
\fI@mailto@\fR.
.PP
No mail will be sent if an unauthorized user tries to run
\fBsudo\fR
with the
\fB\-l\fR
or
\fB\-v\fR
option unless there is an authentication error and
either the
\fImail_always\fR
or
\fImail_badpass\fR
flags are enabled.
This allows users to
determine for themselves whether or not they are allowed to use
\fBsudo\fR.
By default, all attempts to run
\fBsudo\fR
(successful or not)
are logged, regardless of whether or not mail is sent.
.PP
If
\fBsudo\fR
is run by
\fBroot\fR
and the
\fRSUDO_USER\fR
environment variable
is set, the
\fBsudoers\fR
policy will use this value to determine who
the actual user is.
This can be used by a user to log commands
through sudo even when a
\fBroot\fR
shell has been invoked.
It also
allows the
\fB\-e\fR
option to remain useful even when invoked via a
sudo-run script or program.
Note, however, that the
\fIsudoers\fR
file lookup is still done for
\fBroot\fR,
not the user specified by
\fRSUDO_USER\fR.
.PP
\fBsudoers\fR
uses per-user time stamp files for credential caching.
Once a user has been authenticated, a record is written
containing the user-ID that was used to authenticate, the
terminal session ID, the start time of the session leader
(or parent process) and a time stamp
(using a monotonic clock if one is available).
The user may then use
\fBsudo\fR
without a password for a short period of time (@timeout@ minutes
unless overridden by the
\fItimestamp_timeout\fR
option).
By default,
\fBsudoers\fR
uses a separate record for each terminal, which means that
a user's login sessions are authenticated separately.
The
\fItimestamp_type\fR
option can be used to select the type of time stamp record
\fBsudoers\fR
will use.
.PP
The
\fBtsdump\fR
utility, included with the sudo source distribution, can be used to
display the contents of a time stamp file.
See
sudoers_timestamp(@mansectform@)
for details of the time stamp file format.
.SS "Logging"
By default,
\fBsudoers\fR
logs both successful and unsuccessful attempts (as well
as errors).
The
\fIlog_allowed\fR
and
\fIlog_denied\fR
flags can be used to control this behavior.
Messages can be logged to
syslog(3),
a log file, or both.
The default is to log to
syslog(3)
but this is configurable via the
\fIsyslog\fR
and
\fIlogfile\fR
settings.
See
\fIEVENT LOGGING\fR
for a description of the log file format.
.PP
\fBsudoers\fR
is also capable of running a command in a pseudo-terminal and logging
input and/or output.
The standard input, standard output, and standard error can be logged
even when not associated with a terminal.
For more information about I/O logging, see the
\fII/O LOGGING\fR
section.
.PP
Starting with version 1.9, the
\fIlog_servers\fR
setting may be used to send event and I/O log data to a remote server running
\fBsudo_logsrvd\fR
or another service that implements the protocol described by
sudo_logsrv.proto(@mansectform@).
.SS "Command environment"
Since environment variables can influence program behavior,
\fBsudoers\fR
provides a means to restrict which variables from the user's
environment are inherited by the command to be run.
There are two
distinct ways
\fBsudoers\fR
can deal with environment variables.
.PP
By default, the
\fIenv_reset\fR
flag is enabled.
This causes commands
to be executed with a new, minimal environment.
On AIX (and Linux
systems without PAM), the environment is initialized with the
contents of the
\fI/etc/environment\fR
file.
.if \n(LC \{\
On
BSD
systems, if the
\fIuse_loginclass\fR
flag is enabled, the environment is initialized
based on the
\fIpath\fR
and
\fIsetenv\fR
settings in
\fI/etc/login.conf\fR.
.\}
The
\fRHOME\fR,
\fRMAIL\fR,
\fRSHELL\fR,
\fRLOGNAME\fR
and
\fRUSER\fR
environment variables are initialized based on the target user
and the
\fRSUDO_*\fR
variables are set based on the invoking user.
Additional variables, such as
\fRDISPLAY\fR,
\fRPATH\fR
and
\fRTERM\fR,
are preserved from the invoking user's environment if permitted by the
\fIenv_check\fR,
or
\fIenv_keep\fR
options.
A few environment variables are treated specially.
If the
\fRPATH\fR
and
\fRTERM\fR
variables are not preserved from the user's environment, they will be set
to default values.
The
\fRLOGNAME\fR
and
\fRUSER\fR
are handled as a single entity.
If one of them is preserved (or removed) from the user's environment,
the other will be as well.
If
\fRLOGNAME\fR
and
\fRUSER\fR
are to be preserved but only one of them is present in the user's environment,
the other will be set to the same value.
This avoids an inconsistent environment where one of the variables
describing the user name is set to the invoking user and one is
set to the target user.
Environment variables with a value beginning with
\(oq()\(cq
are removed unless both the name and value parts are matched by
\fIenv_keep\fR
or
\fIenv_check\fR,
as they may be interpreted as functions by the
\fBbash\fR
shell.
Prior to version 1.8.11, such variables were always removed.
.PP
If, however, the
\fIenv_reset\fR
flag is disabled, any variables not
explicitly denied by the
\fIenv_check\fR
and
\fIenv_delete\fR
options are allowed and their values are
inherited from the invoking process.
Prior to version 1.8.21, environment variables with a value beginning with
\(oq()\(cq
were always removed.
Beginning with version 1.8.21, a pattern in
\fIenv_delete\fR
is used to match
\fBbash\fR
shell functions instead.
Since it is not possible
to block all potentially dangerous environment variables, use
of the default
\fIenv_reset\fR
behavior is encouraged.
.PP
Environment variables specified by
\fIenv_check\fR,
\fIenv_delete\fR,
or
\fIenv_keep\fR
may include one or more
\(oq*\(cq
characters which will match zero or more characters.
No other wildcard characters are supported.
.PP
By default, environment variables are matched by name.
However, if the pattern includes an equal sign
(\(oq=\&\(cq),
both the variables name and value must match.
For example, a
\fBbash\fR
shell function could be matched as follows:
.nf
.sp
.RS 4n
env_keep += "BASH_FUNC_my_func%%=()*"
.RE
.fi
.PP
Without the
\(oq=()*\(cq
suffix, this would not match, as
\fBbash\fR
shell functions are not preserved by default.
.PP
The complete list of environment variables that are preserved or removed,
as modified by global Defaults parameters in
\fIsudoers\fR,
is displayed when
\fBsudo\fR
is run by
\fBroot\fR
with the
\fB\-V\fR
option.
The list of environment variables to remove
varies based on the operating system
\fBsudo\fR
is running on.
.PP
Other settings may influence the command environment:
.TP 3n
\fB\(bu\fR
\fBsudoers\fR
options such as
\fIalways_set_home\fR,
\fIsecure_path\fR,
\fIset_logname\fR,
\fIset_home\fR,
and
\fIsetenv\fR.
.TP 3n
\fB\(bu\fR
Command tags, such as
\fRSETENV\fR
and
\fRNOSETENV\fR.
Note that
\fRSETENV\fR
is implied if the command matched is
\fBALL\fR.
.TP 3n
\fB\(bu\fR
\fBsudo\fR
options, such as
\fB\-E\fR
and
\fB\-i\fR.
.PP
On systems that support PAM where the
\fBpam_env\fR
module is enabled for
\fBsudo\fR,
variables in the PAM environment may be merged in to the environment.
If a variable in the PAM environment is already present in the
user's environment, the value will only be overridden if the variable
was not preserved by
\fBsudoers\fR.
When
\fIenv_reset\fR
is enabled, variables preserved from the invoking user's environment
by the
\fIenv_keep\fR
list take precedence over those in the PAM environment.
When
\fIenv_reset\fR
is disabled, variables present the invoking user's environment
take precedence over those in the PAM environment unless they
match a pattern in the
\fIenv_delete\fR
list.
.PP
The dynamic linker on most operating systems will remove variables
that can control dynamic linking from the environment of set-user-ID
executables, including
\fBsudo\fR.
Depending on the operating
system this may include
\fR_RLD*\fR,
\fRDYLD_*\fR,
\fRLD_*\fR,
\fRLDR_*\fR,
\fRLIBPATH\fR,
\fRSHLIB_PATH\fR,
and others.
These type of variables are
removed from the environment before
\fBsudo\fR
even begins execution
and, as such, it is not possible for
\fBsudo\fR
to preserve them.
.PP
As a special case, if the
\fB\-i\fR
option (initial login) is
specified,
\fBsudoers\fR
will initialize the environment regardless
of the value of
\fIenv_reset\fR.
The
\fRDISPLAY\fR,
\fRPATH\fR
and
\fRTERM\fR
variables remain unchanged;
\fRHOME\fR,
\fRMAIL\fR,
\fRSHELL\fR,
\fRUSER\fR,
and
\fRLOGNAME\fR
are set based on the target user.
On AIX (and Linux
systems without PAM), the contents of
\fI/etc/environment\fR
are also
included.
.if \n(LC \{\
On
BSD
systems, if the
\fIuse_loginclass\fR
flag is
enabled, the
\fIpath\fR
and
\fIsetenv\fR
variables in
\fI/etc/login.conf\fR
are also applied.
.\}
All other environment variables are removed unless permitted by
\fIenv_keep\fR
or
\fIenv_check\fR,
described above.
.PP
Finally, the
\fIrestricted_env_file\fR
and
\fIenv_file\fR
files are applied, if present.
The variables in
\fIrestricted_env_file\fR
are applied first and are subject to the same restrictions as the
invoking user's environment, as detailed above.
The variables in
\fIenv_file\fR
are applied last and are not subject to these restrictions.
In both cases, variables present in the files will only be set to
their specified values if they would not conflict with an existing
environment variable.
.SH "SUDOERS FILE FORMAT"
The
\fIsudoers\fR
file is composed of two types of entries: aliases
(basically variables) and user specifications (which specify who
may run what).
.PP
When multiple entries match for a user, they are applied in order.
Where there are multiple matches, the last match is used (which is
not necessarily the most specific match).
.PP
The
\fIsudoers\fR
file grammar will be described below in Extended Backus-Naur
Form (EBNF).
Don't despair if you are unfamiliar with EBNF; it is fairly simple,
and the definitions below are annotated.
.SS "Resource limits"
By default,
\fBsudoers\fR
uses the operating system's native method of setting resource limits
for the target user.
On Linux systems, resource limits are usually set by the
\fIpam_limits.so\fR
PAM module.
On some BSD systems, the
\fI/etc/login.conf\fR
file specifies resource limits for the user.
On AIX systems, resource limits are configured in the
\fI/etc/security/limits\fR
file.
If there is no system mechanism to set per-user resource limits,
the command will run with the same limits as the invoking user.
The one exception to this is the core dump file size, which is set by
\fBsudoers\fR
to 0 by default.
Disabling core dumps by default makes it possible to avoid potential
security problems where the core file is treated as trusted input.
.PP
Resource limits may also be set in the
\fIsudoers\fR
file itself, in which case they override those set by the system.
See the
\fIrlimit_as\fR,
\fIrlimit_core\fR,
\fIrlimit_cpu\fR,
\fIrlimit_data\fR,
\fIrlimit_fsize\fR,
\fIrlimit_locks\fR,
\fIrlimit_memlock\fR,
\fIrlimit_nofile\fR,
\fIrlimit_nproc\fR,
\fIrlimit_rss\fR,
\fIrlimit_stack\fR
options described below.
Resource limits in
\fBsudoers\fR
may be specified in one of the following formats:
.TP 8n
\(lqvalue\(rq
Both the soft and hard resource limits are set to the same value.
The special value
\(lqinfinity\(rq
can be used to indicate that the value is unlimited.
.TP 8n
\(lqsoft,hard\(rq
Two comma-separated values.
The soft limit is set to the first value and the hard limit is set
to the second.
Both values must either be enclosed in a set of double quotes,
or the comma must be escaped with a backslash
(\(oq\e\(cq).
The special value
\(lqinfinity\(rq
may be used in place of either value.
.TP 8n
\(lqdefault\(rq
The default resource limit for the user will be used.
This may be a user-specific value (see above) or the value of the
resource limit when
\fBsudo\fR
was invoked for systems that don't support per-user limits.
.TP 8n
\(lquser\(rq
The invoking user's resource limits will be preserved when running
the command.
.PP
For example, to restore the historic core dump file size behavior,
a line like the following may be used.
.sp
.RS 6n
Defaults rlimit_core=default
.RE
.PP
Resource limits in
\fBsudoers\fR
are only supported by version 1.8.7 or higher.
.SS "Quick guide to EBNF"
EBNF is a concise and exact way of describing the grammar of a language.
Each EBNF definition is made up of
\fIproduction rules\fR.
For example:
.nf
.sp
.RS 4n
symbol ::= definition | alternate1 | alternate2 ...
.RE
.fi
.PP
Each
\fIproduction rule\fR
references others and thus makes up a
grammar for the language.
EBNF also contains the following
operators, which many readers will recognize from regular
expressions.
Do not, however, confuse them with
\(lqwildcard\(rq
characters, which have different meanings.
.TP 6n
\&?
Means that the preceding symbol (or group of symbols) is optional.
That is, it may appear once or not at all.
.TP 6n
*
Means that the preceding symbol (or group of symbols) may appear
zero or more times.
.TP 6n
+
Means that the preceding symbol (or group of symbols) may appear
one or more times.
.PP
Parentheses may be used to group symbols together.
For clarity,
we will use single quotes
('')
to designate what is a verbatim character string (as opposed to a symbol name).
.SS "Aliases"
There are four kinds of aliases:
\fIUser_Alias\fR,
\fIRunas_Alias\fR,
\fIHost_Alias\fR
and
\fICmnd_Alias\fR.
Beginning with
\fBsudo\fR
1.9.0,
\fICmd_Alias\fR
may be used in place of
\fICmnd_Alias\fR
if desired.
.nf
.sp
.RS 0n
Alias ::= 'User_Alias' User_Alias_Spec (':' User_Alias_Spec)* |
'Runas_Alias' Runas_Alias_Spec (':' Runas_Alias_Spec)* |
'Host_Alias' Host_Alias_Spec (':' Host_Alias_Spec)* |
'Cmnd_Alias' Cmnd_Alias_Spec (':' Cmnd_Alias_Spec)* |
'Cmd_Alias' Cmnd_Alias_Spec (':' Cmnd_Alias_Spec)*
User_Alias ::= NAME
User_Alias_Spec ::= User_Alias '=' User_List
Runas_Alias ::= NAME
Runas_Alias_Spec ::= Runas_Alias '=' Runas_List
Host_Alias ::= NAME
Host_Alias_Spec ::= Host_Alias '=' Host_List
Cmnd_Alias ::= NAME
Cmnd_Alias_Spec ::= Cmnd_Alias '=' Cmnd_List
NAME ::= [A\(enZ]([A\(enZ][0\(en9]_)*
.RE
.fi
.PP
Each
\fIalias\fR
definition is of the form
.nf
.sp
.RS 0n
Alias_Type NAME = item1, item2, ...
.RE
.fi
.PP
where
\fIAlias_Type\fR
is one of
\fIUser_Alias\fR,
\fIRunas_Alias\fR,
\fIHost_Alias\fR,
or
\fICmnd_Alias\fR.
A
\fRNAME\fR
is a string of uppercase letters, numbers,
and underscore characters
(\(oq_\(cq).
A
\fRNAME\fR
\fBmust\fR
start with an
uppercase letter.
It is possible to put several alias definitions
of the same type on a single line, joined by a colon
(\(oq:\&\(cq).
For example:
.nf
.sp
.RS 0n
Alias_Type NAME = item1, item2, item3 : NAME = item4, item5
.RE
.fi
.PP
It is a syntax error to redefine an existing
\fIalias\fR.
It is possible to use the same name for
\fIaliases\fR
of different types, but this is not recommended.
.PP
The definitions of what constitutes a valid
\fIalias\fR
member follow.
.nf
.sp
.RS 0n
User_List ::= User |
User ',' User_List
User ::= '!'* user name |
'!'* #user-ID |
'!'* %group |
'!'* %#group-ID |
'!'* +netgroup |
'!'* %:nonunix_group |
'!'* %:#nonunix_gid |
'!'* User_Alias
.RE
.fi
.PP
A
\fIUser_List\fR
is made up of one or more user names, user-IDs
(prefixed with
\(oq#\(cq),
system group names and IDs (prefixed with
\(oq%\(cq
and
\(oq%#\(cq
respectively), netgroups (prefixed with
\(oq+\(cq),
non-Unix group names and IDs (prefixed with
\(oq%:\(cq
and
\(oq%:#\(cq
respectively), and
\fIUser_Alias\fRes.
Each list item may be prefixed with zero or more
\(oq\&!\(cq
operators.
An odd number of
\(oq\&!\(cq
operators negate the value of
the item; an even number just cancel each other out.
User netgroups are matched using the user and domain members only;
the host member is not used when matching.
.PP
A
\fIuser name\fR,
\fIuser-ID\fR,
\fIgroup\fR,
\fIgroup-ID\fR,
\fInetgroup\fR,
\fInonunix_group\fR
or
\fInonunix_gid\fR
may be enclosed in double quotes to avoid the
need for escaping special characters.
Alternately, special characters
may be specified in escaped hex mode, e.g., \ex20 for space.
When
using double quotes, any prefix characters must be included inside
the quotes.
.PP
The actual
\fInonunix_group\fR
and
\fInonunix_gid\fR
syntax depends on
the underlying group provider plugin.
For instance, the QAS AD plugin supports the following formats:
.TP 3n
\fB\(bu\fR
Group in the same domain: "%:Group Name"
.TP 3n
\fB\(bu\fR
Group in any domain: "%:Group [email protected]"
.TP 3n
\fB\(bu\fR
Group SID: "%:S\-1\-2\-34\-5678901234\-5678901234\-5678901234\-567"
.PP
See
\fIGROUP PROVIDER PLUGINS\fR
for more information.
.PP
Quotes around group names are optional.
Unquoted strings must use a backslash
(\(oq\e\(cq)
to escape spaces and special characters.
See
\fIOther special characters and reserved words\fR
for a list of
characters that need to be escaped.
.nf
.sp
.RS 0n
Runas_List ::= Runas_Member |
Runas_Member ',' Runas_List
Runas_Member ::= '!'* user name |
'!'* #user-ID |
'!'* %group |
'!'* %#group-ID |
'!'* %:nonunix_group |
'!'* %:#nonunix_gid |
'!'* +netgroup |
'!'* Runas_Alias |
'!'* ALL
.RE
.fi
.PP
A
\fIRunas_List\fR
is similar to a
\fIUser_List\fR
except that instead
of
\fIUser_Alias\fRes
it can contain
\fIRunas_Alias\fRes.
User names and groups are matched as strings.
In other words, two users (groups) with the same user (group) ID
are considered to be distinct.
If you wish to match all user names with the same user-ID (e.g.,
\fBroot\fR
and
\fBtoor\fR),
you can use a user-ID instead of a name (#0 in the example given).
The user-ID or group-ID specified in a
\fIRunas_Member\fR
need not be listed in the password or group database.
.nf
.sp
.RS 0n
Host_List ::= Host |
Host ',' Host_List
Host ::= '!'* host name |
'!'* ip_addr |
'!'* network(/netmask)? |
'!'* +netgroup |
'!'* Host_Alias |
'!'* ALL