File: super.5.in

package info (click to toggle)
super 3.11.6-1
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 660 kB
  • ctags: 592
  • sloc: ansic: 7,338; sh: 183; makefile: 175
file content (1841 lines) | stat: -rw-r--r-- 45,964 bytes parent folder | download
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
.TH SUPER 5 local
.\"
.\"	Copyright (c) 1993 by California Institute of Technology.
.\"	Written by William Deich.  Not derived from licensed software.
.\"
.\"    You may distribute under the terms of either the GNU General Public
.\"    License or the Artistic License, as specified in the README file.
.\"  
.\"
.SH NAME
super.tab \- database of restricted commands for super(1)
.SH DESCRIPTION
The
.I super.tab
file contains the restrictions on who can execute commands with
.BR super (1).
It may also contain options that modify the uid and/or gid under which
a command is run; the list of environment variables that are discarded before
executing a command, and so on.
The reader is expected to be familiar with the
.BR super (1)
man page.
.PP
.I Super
has a great many options; however, none of them are required for security,
so you don't have to be intimately familiar with this entire document in
order to use
.I super
securely.
The most important options that you will probably want to use are probably
and (a)
a logging option like
.IR logfile= xxx
or
.IR syslog=y ;
and (b) to change from the default regular-expression interpretation of
wildcards to the more convenient shell-style glob patterns:
.IR patterns=shell .
.PP
If you are trying to avoid reading this lengthy man page, you just need
to know that for a user to successfully execute a command by typing
.IR super\ commandName ,
the minimum entry in the
.I super.tab
is something like
.ti +.5i
.B commandName\ \  FullPathToCommand\ \ userName
.br
For example, the entry
.ti +.5i
.B cdmount\ \  /usr/local/bin/cdmount\ \ molly,dolly
.br
says that users
.I molly
and
.I dolly
may execute the
/usr/local/bin/cdmount
program by typing
.IR super\ cdmount .
.PP
Unless modified with options in the
.I super.tab
file, super executes commands
using effective uid root; unchanged real uid and gid;
no supplementary groups; no open file descriptors save 0, 1, and 2;
no environment variables except a few with safe values
(see 
.BR super.1 );
and signal handling reset to the default.
.PP
When
.I super
uses a command from a user-supplied super file (\fB.supertab\fP in the
user's home directory) these rules are modified: the real and effective
uid and gid are set to the owner of the
.B .supertab
file, and the supplementary groups are set to the user's login groups.
.PP
The
.I super.tab
file is formatted as a series of control lines of the form
.sp
.ti +.5i
.B CmdPat\ \ FullPath\ \ Options\ \\\\
.ti 3.5i
.B PermittedUsers PermittedTimes
.\" .RE
.br
or
.br
.ti +.5i
.B CmdPat1::FullPath1 CmdPat2::FullPath2 ...\\\\
.ti 2.5i
.B Options\ \ PermittedUsers PermittedTimes
.br
or
.br
.ti +.5i
.B \fI:\fPBuiltinCmd  arguments
.sp
The
.IR Options ,
.IR PermittedUsers ,
and
.IR PermittedTimes
may be mixed together in any order.
For each control line,
.I Super
matches the following:
.RS
.HP
\(bu the user-entered command to a
.IR CmdPat ;
.HP
\(bu the {user,group,host} triplet to a
.I PermittedUsers
entry; and
.HP
\(bu the current time to a
.I PermittedTimes
entry.
.RE
.PP
If these conditions are not satisfied,
.I super
``falls through'' and tries the next control line.
.PP
For example, the entry
.sp
.RS
.nf
.B renice\ /etc/renice\ jack@hill jill@bucket time~8-17
.fi
.RE
.sp
specifies that between hours 8:00 and 17:00,
user Jack can renice any process on host hill,
and user Jill can do so on host bucket,
by simply typing
.B "super renice <args>  ."
.PP
Control lines begin in column 1, and the
fields are whitespace-separated.
Note that you can either use a single
.I CmdPat
and
.IR FullPath ,
separated by whitespace, or you can use a series of them in one
control line by putting
.RB ` :: '
between each
.I CmdPat
and
.I FullPath
pair.

Whitespace may be included in a field by enclosing text in single- or
double-quotes.  The quoting is shell-like, in the sense that quotemarks
don't have to surround the entire field, and you can switch between
quotemark types in a single entry.  For instance, \fBX"a\ b"Y'd\ e'\fR
is equivalent to \fB"Xa\ bYd\ e"\fR.
Comments begin with a `#' and continue to the end of a line.
.PP
There can also be blank or comment lines without any control data.
.PP
A control line may be continued by preceding the newline
with a backslash, and indenting the continuation line with whitespace.
When the multiple-line entry is read, the text just before the
backslash-newline is not modified (any whitespace before the backslash
will be kept), and the backslash-newline-whitespace
sequence is either eliminated entirely or treated as whitespace.
The rule is simple: following a letter, digit, or underscore, it is
treated as whitespace.  Otherwise, it is eliminated.  This means that
.ne 5
.sp
.nf
.RS
\fBCmd\ \ File\ \ user1\\\fP
\fB\ \ \ \ \ \ \ \ \ \ \ user2\\\fP
\fB\ \ \ \ \ \ \ \ \ \ \ user3\fP
.RE
.fi
.sp
.ne 5
is equivalent to
.sp
.RS
.B Cmd\ \ File\ \ user1 user2 user3
.RE
.sp
.ne 5
On the other hand,
.sp
.nf
.RS
\fBCmd\ \ File\ \ {user1,\\\fP
\fB\ \ \ \ \ \ \ \ \ \ \ user2,\\\fP
\fB\ \ \ \ \ \ \ \ \ \ \ user3}\fP
.RE
.fi
.sp
.ne 5
is equivalent to
.sp
.RS
.B Cmd\ \ File\ \ {user1,user2,user3}
.RE
.sp
That is, the sensible interpretation is done in both cases.
.PP
The indentation requirement for continuation lines helps
.B super
catch typos.
Comments may be placed before each backslash-newline pair,
not just at the end of a continued control line.
.PP
.SH The CmdPat Field
.PP
In response to the user typing
.sp
.RS
.B super
.IR cmd " [" " args " ],
.RE
.sp
the
.I cmd
is searched for in the
.I super.tab
file.
The
.I cmd
is matched against each pattern
.IR CmdPat .
.PP
.B "Basic Use: Simple Command Patterns without Wildcards."
.PP
Typically, a
.I CmdPat
just uses plain characters without any regular-expression special characters,
so a
.I cmd
must be the same as the
.I CmdPat
string.  For example:
.sp
.RS
.B
skill /usr/local/bin/skill   user1 user2 user3
.RE
.sp
Here, any user in the list {user1, user2, user3} may type
.B super skill
to execute /usr/local/bin/skill.
.PP
.B "Advanced Use: Command Patterns with Wildcards."
.PP
More generally, a
.IR CmdPat
can be either an
\fIed\fR-style pattern (``regex'' \(em the BSD\ 4.x syntax used in the
re_comp()/re_exec()
routines) or a Bourne-shell-style
regular expression.  You can set the pattern style using
the global option \fBpatterns\fR (see below).
The default is ``regex'' for historical reasons; however,
shell-style patterns are easier to use without errors,
and most sites should use shell-style patterns.
In both cases the patterns are extended to support csh-style
brace expansion.
For instance,
.B a{x,y,z}b
stands for the set of patterns
.BR "axb ayb azb" .
Don't put any whitespace inside the braces!
.PP
For convenience,
there is always an implied set of braces around an entire pattern.
This means that any comma-separated list
.B "a,b,c"
is interpreted as
.BR "{a,b,c}" ,
and is very helpful so that you don't have to worry about getting
braces just right when you build complex lists of
out of (say) variables containing other lists of users.
.PP
All pattern matching is ``anchored'': patterns are forced to match
the entire
.I cmd
string.
.PP
If the
.I CmdPat
is matched and the other conditions are met
(such as the user being in the PermittedUser list to execute this command),
.I FullPath
gives the name of the actual command that will be executed with
.IR execve() .
If
.I FullPath
contains an asterisk, the asterisk is first replaced by the user's
.IR cmd .
.PP
If you put special pattern-matching characters into the
.IR CmdPat ,
but don't put an asterisk into
.IR FullPath ,
you have simply given more ways a user can execute the same
.I FullPath.
This isn't useful, and in fact isn't a good idea at all.
The power of using patterns in the
.I CmdPat
comes when
.I FullPath
includes an asterisk.
For instance, a SysV-based host might have
.ne 5
an entry in the
.I super.tab
file that looks like:
.sp
.RS
\fB/usr/bin/{lp,lpstat,disable,enable,cancel} * \\\fP
.br
.B \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ :operators uid=0
.RE
.sp
This would allow anybody in the "operators" group to have root access
to the line printer commands
(the \fIuid=0\fP tells
.B super
to set the real uid to 0, not just the effective uid).
.ne 3
For instance, if the user typed:
.sp
.RS
.BI "super /usr/bin/disable " some_printer
.RE
.sp
then the
.I FullPath
(``\fB*\fR'') would be replaced by
.BR /usr/bin/disable ,
which would be the command to exec.
.sp
More conveniently, the
.I super.tab
.ne 5
file could have a line like:
.sp
.RS
\fB{lp,lpstat,disable,enable,cancel} /usr/bin/* \\\fP
.br
.B \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ :operators uid=0
.RE
.sp
In this case, the user can type
.sp
.RS
.BI "super disable " some_printer
.RE
.sp
The asterisk-replacement ability also lets a user execute any
of an entire directory of commands, using a
.I super.tab
entry like the following:
.sp
.RS
\fBop/* /usr/local/super/scripts/* :operators uid=0
.RE
.sp
In this case, the user can type
.sp
.RS
.BI "super op/" xyz
.RE
.sp
and
.I super
will execute
.I /usr/local/super/scripts/op/xyz.
.PP
The asterisk-replacement capability is useful but potentially dangerous,
because it may unintentionally open the door to programs you hadn't intended
to give away.
It is a sensible precaution to restrict asterisk-replacement
to entries where the valid-user list includes trusted users only.
.PP 
If you
.I completely
trust some users, but want logging of all actions executed as root,
.ne 5
you could use:
.sp
.RS
.B /* \ \ * \ \ \fIReallyReallyTrustedUsers\fP
.RE
or
.RS
.B /.* \ \ * \ \ \fIReallyReallyTrustedUsers\fP
.RE
.sp
(depending on whether \fBpatterns=shell\fP or \fBpatterns=regex\fP).
The trusted users can now execute any command.  Note that the pattern
begins with a slash, to ensure that the
.I cmd
must be an absolute path -- this helps avoid accidental execs of the
wrong program.
.PP
If you were really going to give everything away as shown
above, you'd probably want to exclude any public-area
workstations, require the trusted users to periodically give
their passwords, and set the real uid=root (instead of just the effective
.ne 5
uid), so the entry might be modified to read something like:
.sp
.RS
.nf
\fB/* \ \ * \ \ \fITrustedUsers\fP \\
\fB\ \ \ \ \ \ \ \ \ !{\fIPatternsOfPublicWorkstations\fP} \\\fP
\fB\ \ \ \ \ \ \ \ \ password=y timeout=5 uid=0\fP
.fi
.RE
.sp
.PP
.SH The FullPath Field
.PP
The
.I FullPath
field
gives the name of the actual command that will be executed,
and if it contains an asterisk, the asterisk is first replaced by the user's
.IR cmd
string.
The
.I FullPath
can optionally contain a list of initial arguments that precede any
arguments passed by the user.
For example,
.sp
.RS
\fBxyz	"/usr/local/bin/blah \-o1 \-o2 \-xrm 'a b c'" ...\fR
.RE
.sp
specifies that when a valid user types
.BR "super xyz" ,
the command to execute is
.B /usr/local/bin/blah
and its arguments will be
.RS
argv[1]: \fB\-o1\fR
.br
argv[2]: \fB\-o2\fR
.br
argv[3]: \fB\-xrm\fR
.br
argv[4]: \fBa b c\fR
.RE
followed by any arguments that the user put on the super command line.
Note: asterisk replacement is only done on the filename part of the
.IR FullPath ,
not on the arguments.  You can safely include asterisks
in the argument list.  For security,
the user's
.I cmd
may not contain any whitespace or backslashes.
.PP
The
.I FullPath
string is parsed using rules similar to the Bourne shell rules
for backslashes in quoted strings, namely:
.RS
.br
(a) backslash-newline is discarded;
.br
(b) Otherwise, if outside a quoted substring,
\fB\\\fIx\fR \(-> plain \fIx\fR, which will not be treated as a delimiter,
quotemark, or comment character;
.br
(c) Otherwise, inside a quoted substring of \fIFullPath\fR:
.RS
\fB\\\\\fR \(-> \fB\\\fR;
.br
\fB\\\fR\fIq\fR \(-> \fIq\fR,
where
.I q
is the quote character that encloses the
.I FullPath
string;
.br
other backslashes are preserved: \fB\\x\fR \(-> \fB\\x\fR.
.RE
.RE
.PP
After writing a command with such backslash escapes,
you should certainly use
.RB `` super\ \-d\ cmd ''
to check
that your args are being parsed
as expected before you offer this command to your users.
.PP
The same
.I cmd
can be listed several times in the
.I super.tab
file, in which case the first entry that allows the user to
execute the command is chosen.
The EXAMPLES section shows how this can be useful.
.PP
.SH Permitted Users
.PP
Permitted users are those
who may execute the specified \fICmd\fP's.
Entries for any number of permitted users are given after
the
.I CmdPat
and
.IR FullPath
fields.
Local options \(em options that apply to this command only \(em
may also appear anywhere after the
.IR FullPath .
Options are distinguished from permitted users because options
all have the form
.IR key = value ,
whereas
permitted-user entries may not contain unescaped equal signs.
Each whitespace-separated word is a pattern in one of the formats
.in +.5i
.sp
\(bu	[\fBuser~\fP]\fIuser\fR[\fB:\fR][\fB@\fIhost\fR]
.sp
\(bu	[\fBuser~\fP]\fB:\fIgroup\fR[\fB@\fIhost\fR]
.sp
\(bu	[\fBuser~\fP]\fIuser\fR[\fB:\fIgroup\fR][\fB@\fIhost\fR]
.sp
.in -.5i
Note that the
.B user~
part is optional.
The user's login name must match the
.I user
pattern; the user must belong to a group whose name matches the
.I group
pattern; and the hostname must match the
.I host
pattern.
If the
.I user,
.I group,
or
.I host
part is not given, there are no corresponding restrictions.
.sp
By default, the ``group'' field is first matched against named groups
to which the user belongs,
and then against the user's decimal gid -- this allows the user to
be put in a group in the /etc/passwd file that isn't given a name
in the /etc/group file.
(If you want to change the rules for using decimal gid, see the
use of MATCH_DECIMAL_UID and MATCH_DECIMAL_GID in
.I super.c
for details.)
.sp
Since you can restrict users to particular hosts, a single
.I super.tab
file can be shared among many different machines.
If the
.I host
part is of the form
.BI + xyz ,
then
.I xyz
is interpreted as a netgroup name and any host in netgroup
.I xyz
is matched.  In that case, 
.I xyz
is taken literally, and
.I not
interpreted as a pattern to be matched.
Note: netgroup lookup is only
implemented if the function
.I innetgr()
is available.
.sp
If the
.I host
part doesn't match the hostname, it might be because
the pattern and actual hostnames contain two different (but both valid)
incomplete versions of the fully-qualified domain name (FQDN).
By default, if the
.I host
part fails to match the hostname, the FQDN is looked up and
all of the ways of naming the host are matched against
the pattern.
For example, if the FQDN is \fIspacely.sprockets.com\fP,
.B super
will first try
.IR spacely.sprockets.com ,
then
.IR spacely.sprockets ,
and finally
.IR spacely .
This can be turned off; see option
.BR gethostbyname .
(You might want to turn it off because using nameserver lookup
can reduce security a bit \(em your host may
query a nameserver on another host to obtain the FQDN, and (a) that
nameserver or an intermediate host along the way could
have been subverted, or (b) another host could impersonate the nameserver.
In either case your computer could receive incorrect hostnames.)
.PP
The patterns for valid users, groups, and hosts follow the same rules
for the
.IR CmdPat s,
described above: they can be entered with either
.IR ed -style
or
Bourne-shell-style patterns (depending on the setting of the
.B patterns
global option); csh-style brace expansion is allowed;
and all pattern matching is ``anchored'': patterns
are forced to match the entire username, groupname, or hostname.
.PP
To make it easy to exclude some users/groups/hosts, any of these
patterns can be negated by prefixing the pattern
with `\fB!\fP'.  If a negated pattern is matched,
the user may \fInot\fP execute the command, even
if there was a previous non-negated pattern that the user matched.
All patterns are read left-to-right, and the last matched
pattern ``wins''.  Thus if the user/group/host list is
.sp
.RS
.B j.*  !jo
.br
or
.br
.B user~j.*  !user~jo
.RE
.sp
then the first entry allows any username beginning with `\fBj\fP' to execute
the command, but the second entry disallows user `\fBjo\fP'.
If entered in the reverse order,
.sp
.RS
.B !jo  j.*
.RE
.sp
then the second entry, `\fBj.*\fP', allows all users beginning `\fBj\fP', and
therefore the first entry has no effect.
.PP
.SH Permitted Times
.PP
The
.B time
condition restricts the days and times during which this command
may be matched.  If the execution time isn't acceptable, then super
ignores the control line, and ``falls through'' to inspect the next entry,
just as it does if the user/group/host aren't acceptable.
A time condition looks like:
.ti +.5i
.BI time~ pattern
.sp
with
.IR pattern s
that look like:
.sp
.RS
.\" Older .BR macros limit the number of arguments, so we insert
.\" the font alternation explicitly in these examples (blecch!)
.ta 3i
\fIPattern	Example\fP
.br
\fBhh\fR[\fB:mm\fR]\fB\-hh\fR[\fB:mm\fR][\fB/dayname\fR]	13:30-17/monday
.br
\fR{\fB<\fR,\fB>\fR,\fB<=\fR,\fB>=\fR}\fBhh\fR[\fB:mm\fR][\fB/dayname\fR]	<17/tues
.br
\fBdayname\fP	Friday
.fi
.RE
.PP
The first form explicitly specifies an interval during which the command may
be used.  Times may not go past midnight; to specify the night between
Monday and Tuesday, you must do something like:
.RS
.B time~{17:30-24:00/mon,0-8/tues}
.RE
.sp
The second form for time patterns allows you to use logical operators.
The Monday-night example could equally have been rendered as:
.RS
.B time~{>17:30/mon,<8/tues}
.RE
(There is a tiny difference in the two examples above: in the first example,
the time range includes 17:30 and 8:00; in the second example, the time
range is 17:31\-07:59.  Use \fBtime~{>=17:30/mon,<=8/tues}\fP to make
the interpretation identical to the first example.)
.PP
By default, valid
.IR dayname s
are English, but if your system supports the
.IR setlocale( 3 )
function, the global option
.BI lang= zzz
will set the valid names to those of locale
.IR zzz .
Valid
.IR dayname s
are either
(a) the full names of the chosen language;
(b) an official abbreviated day name for that language;
(c) a 3-or-more character abbreviation of the full weekday; or
(d) \fB*\fP, meaning any day.
(You can check on super's valid daynames by executing
.IR super\ \-d ,
which will show the default names of the weekdays at or near the top of
its debugging output, and show the new weekday names that take
effect when the
.BI lang= zzz
option is encountered.)
.PP
Time patterns have a special defaulting rule when
the execution time is not in one of the intervals in the time list:
.RS
\(bu if
.I all
time patterns are negated,
.I super
permits execution at any time not in one of the listed intervals;
.br
\(bu otherwise, there is at least one non-negated pattern, and
.I super
defaults to deny execution at times outside the specified acceptable intervals.
.RE
The reason is that the natural interpretation of a series of negated
conditions, such as
.RS
.B !time~{0-8,17-24}  !time~{sat,sun}
.RE
is to infer that all other times are acceptable for execution.
On the other hand, if there are any ordinary, non-negated times, such as
.RS
.B time~8-17/{mon,tues,wed,thu,fri}
.RE
the natural interpretation is that all other times are not acceptable.
.PP
Note that explicit braces are important in the above list.  If they
were missing, the implied braces around the entire pattern would render this
equivalent to
.RS
.B "time~8-17/mon time~tues time~wed time~thu time~fri"
.RE
That is, the permitted times are 8-17h on Monday,
and any time on Tuesday through Friday.
.PP
.SH Global Conditions
.ta 1i 2i 3i 4i 5i 6i
.PP
Global options and conditions affect the overall
.B super
processing.  To set them, you must use a line like
.sp
.RS
\fB:global\fP		\fIGlobal\ Options\ And\ Patterns\fP
.RE
or
.RS
\fB:global_options\fP	\fIGlobal\ Options\ And\ Patterns\fP
.RE
.sp
For backwards compatibility, you can alternatively use
.RS
.sp
\fB/	/	\fIGlobalOptionsAndPatterns\fR
.sp
.RE
but this use is discouraged.
.PP
These so-called ``global'' options and conditions actually take
effect immediately after the line
on which they appear, and are valid until the end of the input
or until there is a countermanding global option or pattern.
To have a global option or pattern affect the entire file, you must
place it as the \fIfirst non-comment line\fR
of the
.I super.tab
file.
.PP
If there are any PermittedUser or PermittedTime conditions
on the global settings line, they are applied to
each following command in the
.I super.tab
file.
The conditions look like
.sp
.RS
\fB:global	\fIcond cond ...  \fB<>\fP \fIcond cond ...\fR
.RE
.sp
PermittedUser and PermittedTime
conditions to the left of ``\fB<>\fP'' are processed
.I before
the local (per-command) conditions; conditions
to the right of ``\fB<>\fP'' are processed
.I after
the per-command conditions.
If ``\fB<>\fP'' is missing, all conditions are processed after
the local conditions.
For example,
.sp
.RS
.B :global	jan <> !@+badhosts
.RE
.sp
says that user
.I jan
can usually execute any command,
but under no circumstances will a user on any host in netgroup
.I badhosts
be allowed to execute any command.
(User
.I jan
will not be allowed to execute a command if the per-command
conditions disallow it, or if
.I jan
is on one of the
.I badhosts
computers).
.sp
Global PermittedUser (PermittedTime) conditions take effect on
the line on which they are defined,
and are good until another set of global PermittedUser (PermittedTime)
conditions is entered on another
.B :global_option
line.  That is,
a new global condition line replaces any previous global conditions.
.PP
One sensible approach to using global conditions is to put conditions
that allow users to execute commands \fIbefore\fR the per-command conditions
are processed, and to put negating patterns (for users/groups/hosts that
are never to be allowed to execute anything)
\fIafter\fR the per-command conditions.
.PP
(Global options are discussed below, together with local options).
.SH Conditionally-included Control Lines
.PP
Control lines can be conditionally included by using the
.B :if
control line.  This can be helpful when using a single
.I super.tab
file for hosts with different architectures, or hosts in different
NIS domains, etc.
The syntax is:
.sp
.RS
\fB:if  \fIleft \ \ op \ \ \fIright\fP \ \ \ \ \fImoreText\fP 
.RE
.sp
The expression
.I left op right
is evaluated, and if true,
.I moreText
is evaluated as an ordinary control line.  The valid comparison operators
are:
.ta 0.5i 1i 1.5i 2i 2.5 3i 3.5 4i 4.5 5i 5.5 6i
.in +.5i
.sp
\(bu	==	string equality
.br
\(bu	!=	string inequality
.br
\(bu	~	glob match string
.I left
against pattern
.I right
.br
\(bu	!~	negated glob-match.
.br
.in -.5i
For example, you could include a file of commands only valid on
Sun4-type machines as follows:
.sp
.RS
.nf
\fB:if $UNAME_MACHINE ~ sun* \\
\fB\ \ \ \ \ \ \ \ \ :include \ /Path/To/Sun4/File
.fi
.RE
.RB (UNAME_MACHINE
is a variable automatically defined by
.IR super ;
see the following section on variables.)
.sp
If you wanted to exclude Sun4c-type machines from using the file,
you could modify this to be:
.sp
.RS
.nf
\fB:if $UNAME_MACHINE ~ sun* \\
\fB\ \ \ \ :if $UNAME_MACHINE != sun4c \\
\fB\ \ \ \ \ \ \ \ \ :include \ /Path/To/Sun4/File
.fi
.RE
.sp
There are no boolean operators provided.
(Note that there is an implicit boolean
.I and
available by concatenating
.B :if
commands, as shown in the second example above.)
.SH Variables
.PP
.B Super
offers variables to make it easier to handle entries that
are duplicated or are constructed out of other entries.
Variables are defined by typing
.sp
.RS
.B :define VariableName VariableDefinition
.RE
.sp
The
.I VariableName
must be made up only of letters, digits, and/or underscore.

The
.I VariableDefinition
begins at the first non-whitespace character after the
.I VariableName
and continues up to but not including the final newline.
Comments embedded on the variable definition line(s) are
deleted before the variable definition is stored.
A variable definition may be continued across multiple lines
by preceding each newline with a backslash,
and indenting the continuation line with whitespace.
Just as for regular control lines, the backslash-newline-whitespace
sequence is treated as whitespace if it follows a letter, digit, or underscore;
otherwise, it is eliminated.  For example,
.sp
.nf
\fB
.RS
:define  Users   user1,\\
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ user2,\\
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ user3
.RE
.fi
and
.RS
:define Users   user1,user2,user3
.RE
\fR
.sp
are equivalent definitions.
 
Unlike Makefiles, the variable definitions are not scanned first
and then the file re-scanned.  Instead, variables take effect at
the point they are defined, and remain in effect until they are
re-defined or end of file \(em thus variables definitions must precede
their first use in the file.

Variables may contain other variables (which must have already been
defined).  Variable substitution is done when a line is first read.
A line is never re-scanned after variable substitution.

Variables are used in a file by typing
.sp
.RS
.B $VariableName
.RE
.sp
or
.sp
.RS
.B $(VariableName)
.RE
.sp

The special variable
.B $$
is replaced by a single
.RB `` $ ''.
Any other name
.BI $ X
(where
.I X
is not a letter, digit, or underscore) is an error.

Because a line is never re-scanned after variable substitution,
the following sequence:
.sp
.nf
.RS
.B :define A $$
.B :define B A
.B :define C $B $$B
.B $C
.RE
.fi
.sp
defines
.B C
to be simply
.RB `` A\ $B ''.
.PP
Variables can be helpful in grouping users or hosts together.
For example, you might restrict access to a command so that it
can't be run from a public-access workstation:
.nf
.RS
.B :define Room103_WS hosta,hostb,hostc,hostd
.B :define Room105_WS hoste,hostf,hostg,hosth
.B :define Room106_WS +nonprivate
.B :define PublicWorkstations $Room103_WS,$Room105_WS,$Room106_WS
.B SomeCmd   FullPathHere   !@$(PublicWorkstations)
.RE
.fi
.PP
In the above example, we have taken advantage of the implied braces
that are always placed around any pattern, so that the comma-separated
list of workstations is brace-expanded into
.B !@hosta
.B !@hostb\ ...\ !@hoste
.BR !@hostf\ ...\ !@+nonprivate .
.ta 1i 2i 3i 4i 5i 6i
.PP
Some variables are automatically defined by
.I super.
These are particularly useful in conditionally-included lines
.RB ( :if
lines).  If your host doesn't supply these functions, or doesn't support
some of the values that
.I super
tries to fetch, the corresponding variable will be initialized to an
empty string.
(Use
.B super\ \-b
to print the names and values of all builtin variables.
This makes it simple to see what variable values to check in
.B :if
lines.)
.PP
From the
.I gethostname()
or
.I sysinfo()
function:
.in +.5i
\(bu
\fBHOSTNAME\fP	Hostname, possibly canonicalized.
.br
.in -.5i
.PP
From the
.I getdomainname()
function:
.in +.5i
\(bu
NIS_DOMAIN	domain set for NIS purposes.
.br
.in i.5i
.PP
From the
.I sysinfo()
function:
.in +.5i
\(bu
SI_SYSNAME	Name of operating system.
.br
\(bu
SI_HOSTNAME	Name of node.
.br
\(bu
SI_RELEASE	Release of operating system.
.br
\(bu
SI_VERSION	Version field of utsname.
.br
\(bu
SI_MACHINE	Kind of machine.
.br
\(bu
SI_ARCHITECTURE	Instruction set arch.
.br
\(bu
SI_HW_SERIAL	Hardware serial number.
.br
\(bu
SI_HW_PROVIDER	Hardware manufacturer.
.br
\(bu
SI_SRPC_DOMAIN	Secure RPC domain.
.br
\(bu
.in -.5i
.PP
From the
.I uname()
function:
.in +.5i
\(bu
UNAME_SYSNAME	Operating system name.
.br
\(bu
UNAME_NODENAME	The nodename.
.br
\(bu
UNAME_RELEASE	Operating system release.
.br
\(bu
UNAME_VERSION	Operating system version.
.br
\(bu
UNAME_MACHINE	Machine hardware name (class).
.br
.RE
.SH Options
.PP
The configuration file can specify a wide variety of options,
such as requiring the user's password before executing some commands,
or restricting the command-line arguments to match certain patterns.
.PP
.I Options
are handled very differently from
.I conditions
(conditions include user, group, host, and time).
If a control line's conditions aren't met, super falls through and
tries the next control line in the file.  After finding an acceptable
control line, super will execute the command if the options
are satisfied; otherwise, it stops and doesn't search the
.I super.tab
file any further.
.PP
Options can be divided into (a) \fIlocal\fP options,
which are defined on a regular control line, and apply only to that
control line; and (b) \fIglobal\fP options,
which are defined on a
.B :global
or
.B :global_options
line, take effect immediately after the line,
and are valid until the end of the input
or until there is a countermanding global option or pattern.
.PP
All options are orthogonal to each other.  It doesn't matter in what
order they appear on the command line.
.PP
Some options can be given as either local or global options.
If both are used, the local setting overrides the global one.
.PP
Two special names can be used with any of the options
that take user or group ids as arguments:
.BI owner= xxx,
.BI uid= xxx,
.BI gid= xxx,
.BI u+g= xxx,
.BI groups= xxx,
.BI addgroups= xxx.
These names are
.BR <owner> ,
meaning the owner of the file to be executed
(or the owner's group, whichever is appropriate in the context);
and
.BR <caller> ,
meaning the owner or group of the user calling super.
The angle brackets are literally part of the name.
For example, the options
.RS
gid=Foo uid=<caller>
.RE
would change the group to
.IR Foo ,
but leave the uid unchanged.
.PP
The recognized options are:
.PP
.I "Group 1.  Options Affecting How Superfiles Are Read and Processed."
.HP
\fBpatterns=\fIxxx\fR
.br
.B (Global)
Select the pattern-matching type for the user/group/host patterns.
The string
.I xxx
must be one of:
.RS
.HP
.B regex
\(em patterns are ed-style
regular expressions, using the rules embodied in the BSD\ 4.x routines
.IR re_comp()/re_exec() ,
with the addition of csh-style brace expansion.
This is the default for historical reasons, but most people prefer
to use shell-style patterns here, and it is recommended that you put
\fBpatterns=shell\fP (see below) in your global options list.
.HP
.B shell
\(em patterns are approximately Bourne-shell style, with the addition
of csh-style brace expansion.  The patterns are formed from:
.RS
.HP
\\x	force x to be a plain character;
.HP
?	matches any single character;
.HP
*	matches any sequence of 0 or more chars;
.HP
[\fIchars\fP]	matches any single character in the set;
.HP
[^\fIchars\fP]	matches any single char NOT in the set;
.HP
^\fIpat\fP	inverts the sense of the match --
the string must NOT match the pattern.
.RE
.RE
.HP
\fBlang=\fIzzz\fR
.br
.B (Global)
This option sets the language used for weekdays (in time conditions).
Here,
.I zzz
may be any locale available on your host.  For example,
.B lang=de
would typically cause
.I super
to use German names.  The default is the
.B C
locale, hence English names.
.HP
\fBrelative_path=\fIy\fR|\fIn\fR
.br
.B (Global)
If \fIy\fR, FullPathNames can be relative instead of absolute.
By default this is disallowed, because it is almost always a very
foolish (unsafe) thing to do.
.HP
\fBgroup_slash=\fIy\fR|\fIn\fR
.br
.B (Global)
If \fIy\fR, group names can contain a slash.  By default this is disallowed,
so that
.B super
can catch certain typos in the
.I super.tab
file.
(Namely,
.B super
can catch errors in which an entry is of the form
.IB Cmd : File
instead of the required
.IB Cmd :: File.
The trouble is that
.IB Cmd : File
looks syntactically like
.IB user : group,
and can therefore be mistaken for a valid part of a control line.
But the filename will contain a slash \(em unless you have unwisely
enabled the
.B relative_path
option \(em so disallowing
slashes allows
.B super
to flag the line as syntactically invalid.)
.HP
\fBgethostbyname=\fIy\fR|\fIn\fR
.br
.B (Global)
Enables or disables the use of
.I gethostbyname()
to find the fully-qualified domain name
(see the discussion in the
.BR "Permitted Users"
section, which describes the security issues associated with enabling
this option.)
Default: enabled (if your host supports gethostbyname()).
.PP
.I "Group 2.  Logging Options."
.HP
\fBlogfile=\fIxxx\fR
.br
.B (Global)
Enables logging to a local file.
Each invocation of
.B super
(aside from ones for help) generates an entry in
file
.IR xxx .
.HP
\fBloguid=\fIxxx\fR
.br
.B (Global)
If logging is enabled with logfile=\fIxxx\fR, the
logfile will be opened for writing using uid=\fIxxx\fR
(can be either a username or numeric uid).
This option allows you to
have the file created/opened under another uid that
does have cross-host access, such as the uid of a
system manager.
(See
.I timestampuid=xxx
for additional comments).
Default: loguid=0.
.HP
\fBrlog_host=\fIhostname\fR
.br
.B (Global)
Tells super which host's syslog daemon is to receive log messages
when option
.B syslog=y
is enabled.  Default: \fIlocalhost\fP.
.HP
\fBsyslog=\fIy\fR|\fIn\fR
.br
.B (Global)
Logging information is passed to the logs maintained by the
.I syslogd
daemon.
This is independent of the setting of the
.B logfile
option (above).
Error messages are by default logged at priority LOG_ERR (the actual priority
can be specified in the
.IR Makefile ),
and successful attempts to run programs are logged at priority LOG_INFO.
(You could instead configure the
.I syslog.conf
file to forward the messages to a central machine, but
.I rsyslog()
is a convenient alternative that doesn't require separately modifying
.I syslog.conf
on each host.)
.HP
\fBmail="\fImail-command\fB"\fR
.br
.B (Local|Global)
Notices of super failures are piped to the shell command
.IR mail-command .
This is independent of the setting of the
.B logfile
and
.B syslog
options.
For instance,
\fImail="mail -s Super joeblow"\fR
will cause error messages to be mailed to user
.I joeblow
(on some systems you may need to substitute
.I mailx
for
.IR mail ).
Note: the
.I mail-command
is executed by passing it as an argument to
.IR popen(3) .
This is safe to execute because of the clean environment assured
by
.B super.
.HP
\fBmailany="\fImail-command\fB"\fR
.br
.B (Local|Global)
This is identical to the
.I mail
option, except that
.I mailany
sends notification of successful invocations as well as errors.
.PP
.I "Group 3.  Extra Help Information for Users."
.HP
.BI info= xxx
.br
.B (Local)
The string
.I xxx
is printed when giving help to users.  It should be set to a helpful
one-line description of the command.
.PP
.I "Group 4.  Password and Other Restrictions Before Approval."
.HP
\fBmaxlen=\fR[\fImmm\fB\,\fR]\fInnn\fR
.br
.B (Local|Global)
Each argument must be no more than
.I mmm
characters long (including the terminating null),
and the sum length of all arguments must not exceed
.I nnn
characters.  A negative value means that no limit is applied.
The defaults for
.I mmm
and
.I nnn
are set by the compile-time manifest constants
MAXLEN1ARG and MAXLENARGS,
which are usually 1000 and 10,000 characters, respectively.
.HP
\fBnargs=\fR[\fImmm\fB\-\fR]\fInnn\fR
.br
.B (Local)
The user is required to enter
.I mmm - nnn
arguments to the command.  If just
.I nnn
is given, the user must enter exactly
.I nnn
arguments.  These arguments are in addition to any arguments entered
in the command part of the
.I super.tab
file.  The default is to allow
the user to enter any number of arguments.
.HP
\fBarg\fR[\fImmm\fB\-\fR]\fInnn\fB=\fIsss\fR
.br
.B (Local)
This means that the
.IR mmm 'th
or
.IR mmm\-nnn 'th
arguments must match pattern
.IR sss .
The pattern must be enclosed in quotes if it contains whitespace.
Note that this option does not
.I require
that there be
.IR mmm \- nnn
arguments; it only says what those arguments must look like, if entered.
.HP
\fBowner=\fIxxx\fR
.br
.B (Local|Global)
This option specifies that the
.I FullPath
(after asterisk-substitution)
must be owned by user (or uid) \fIxxx\fR, or else it won't be
executed.
.HP
\fBpassword=\fIy\fR|\fIn\fR
.br
.B (Local|Global)
If \fIy\fR, the user's password is required before the command is executed.
See also the options
.I timeout
and
.IR renewtime ,
and be sure to read the warning under
.I timestampbyhost.
.HP
\fBtimeout=\fIm\fR
.br
.B (Local|Global)
Passwords are good for \fIm\fR minutes; that is, the command may be executed
without re-entering the user's password
for \fIm\fR minutes after the last time the user's password was entered
(for any command).  After \fIm\fR minutes, the password will be required
again before the command can be executed.  If \fItimeout\fR is zero or
negative, a password is required every time the command is used.
The timestamp for user \fIusr\fR is recorded in the file
\fBTIMESTAMP_DIR\fR directory (see \fBtimestampbyhost\fR and
the FILES section, below).
.HP
\fBrenewtime=\fIy\fR|\fIn\fR
.br
.B (Global)
If \fIy\fR, the user's timestamp file is updated to the current time
whenever a password-requiring command is executed.
The result is that a user who frequently executes password-requiring
commands won't need to re-enter his or her password until more than
.I timeout
minutes elapse since the last such command.
Otherwise, the user will need to re-enter his or her
.I timeout
minutes after last entering the password.
The default is \fIn\fR.
.HP
\fBtimestampbyhost=\fIy\fR|\fIn\fR
.br
.B (Global)
If \fIy\fR (default), the timestamp files are given names that are
unique on each host.  For instance, \fIjouser@somehost\fR will be
given a timestamp file named \fITIMESTAMP_DIR/somehost/jouser\fR,
where \fITIMESTAMP_DIR\fR is defined in the FILES section.
If \fItimestmapbyhost=n\fR, the timestamp files are given names
that are unique to each user, but not unique per host.  For instance,
\fIjouser\fR on any host will be given a timestamp file named
\fITIMESTAMP_DIR/jouser\fR.
.br
.I WARNING:
The hostname used is that from
.I gethostname().
Note that this is not necessarily unique across
internet domains, since it is frequently not a
fully-qualified domain name.  Therefore you should
not share timestamp directories with hosts outside
the local domain.  (Generally such connections don't
exist, but one
.I could
crossmount the timestamp directory disk...)
.HP
\fBtimestampuid=\fIxxx\fR
.br
If a password is required, the time at which it was entered is
recorded as the mtime of a timestamp file.  The timestamp file
is normally created with owner=root; however, this option
causes it to be created/modified using uid=\fIxxx\fR
(\fIxxx\fR can be either a username or numeric uid).
This option is useful when a network of hosts are
sharing a cross-mounted timestamp directory.  Note that networks
are typically configured to not allow root on one
host to have root access to files on another host,
which will forbid root on other hosts from creating
the timestamp file unless it's world-writable.
This option allows you to
have the file created/opened under another uid that
does have cross-host access, such as the uid of a
system manager.
Default: timestampuid=0.
.PP
.I "Group 5.  Modifications to Environment Before Executing Command."
.HP
.BI uid= xxx
.br
.B (Local)
Set the real and effective uid to
.I xxx
just before executing the command.
The uid
.I xxx
is first tried as a login name and then as a number.
.HP
.BI gid= yyy
.br
.B (Local)
Set the real and effective gid to
.I yyy
just before executing the command.
The gid
.I yyy
is first tried as a group name and then as a number.
.HP
.BI u+g= zzz
.br
.B (Local)
Set the real and effective uid to
.IR zzz ,
the real and effective gid to
.IR zzz 's
login gid,
and the supplementary groups list to
.IR zzz 's
supplementary groups just before executing the command.
Since this option conflicts with
.BI uid=xxx
and
.BI gid=yyy,
it may not be mixed with them.
.HP
\fBgroups=\fIname\fR[,...]
.br
.B (Local|Global)
By default, the user's supplementary groups list is deleted before
executing a command (unless the option
.B u+g
is used).
This option instead sets the group list to \fIname\fR[,...]
.HP
\fBaddgroups=\fIname\fR[,...]
.br
.B (Local|Global)
This option adds the listed groups to the supplementary groups list.
Since the default is to provide an empty supplementary groups list,
this option usually has the same effect as the plain
.B groups
option.
However, if the options
.BI u+g= foo
.BI addgroups= a,b,c
are used, then the supplementary groups list is composed of user
.IR foo 's
supplementary groups plus \fIa, b\fR, and \fIc\fR.
.HP
\fBenv=\fIname\fR[,...]
.br
.B (Global|Local)
Each
.I name
in the comma-separated list is an environment variable which should
.I not
be deleted before executing the
.IR Cmd ;
these variables are in addition to the normal variables created or passed
by
.B super
(TERM, IFS, PATH, USER, LOGNAME, HOME, ORIG_USER, ORIG_LOGNAME,
ORIG_HOME, LINES, COLUMNS, SUPERCMD).
Be careful here; environment variables can sometimes be abused to create
security holes.
If you use the option more than once, the later instance overrides the
earlier one, instead of adding to it.  Similarly, using it as a local
option completely overrides any global setting.
.HP
\fBmaxenvlen=nnn
.br
.B (Global|Local)
Specifies the maximum length of an environment variable definition
(including name, equal size, value, and trailing null character).
The default is given
by the compile-time manifest constant MAXENVLEN, usually 1000 characters.
A negative value means no limit.
.HP
\fBcd=\fIdir\fR
.br
.B (Local|Global)
Just before executing the command,
.I super
changes the working directory to
.IR dir .
.HP
\fBsetenv=\fIvar\fB=\fIxxx\fR
.br
.B (Local)
The environment variable
.I var
is defined to have the value
.IR xxx ,
and is passed on when executing the
.IR Cmd .
You can add several environment variable definitions
by using the option more than once.
.HP
\fBfd=\fIn\fR[,...]
.br
.B (Local)
Each file descriptor
.I n
in the comma-separated list should
.I not
be closed before executing the
.I Cmd.
These descriptors are added to the usual set of descriptors kept open,
namely 0, 1, 2.
.HP
\fBnice=\fIn\fR
.br
.B (Local|Global)
changes the ``nice'' value of the executed command by an amount
.I n
from the default level.  (Positive increments reduce the command's
priority; negative increments increase it.)
.HP
\fBumask=\fInnn\fR
.br
.B (Local|Global)
sets the umask of any executed command to
.IR n .
A leading
.B 0x 
or
.B 0X
in \fInnn\fP means a hexadecimal value; otherwise,
a leading
.B 0
means octal; otherwise it's decimal.
.PP
.I "Group 6.  Other Options"
.HP
.BI print= message
.br
.B (Local)
If the rest of the line is matched, then
.B super
prints the specified
.I message
just before executing the command.
.HP
.BI die= message
.br
.B (Local)
If the rest of the line is matched, then
.B super
prints the specified
.I message
and exits.
This lets you conveniently set up some ``stop'' conditions, and use the
die option to prevent super from looking at any line past the stop
conditions.  Otherwise, you'd have to individually attach the stop
conditions to every control line.
.SH Include Files
.PP
A
.I super.tab
file can include other files by means of an entry like
.RS
.BI :include \ filename
.RE
or
.RS
.BI :optinclude \ filename
.RE
If the
.I filename
isn't an absolute path, it is taken to be relative to the
directory containing the
.I super.tab
file.  Include files may be nested up to the system limit
on the number of
simultaneously-open file descriptors.
The difference between
.B :include
and
.B :optinclude
is that the former generates an error if the named file doesn't exist,
whereas the latter (optional-include) silently ignores files that don't
exist.
.PP
.I WARNING:
You should use
.B :optinclude
with great caution, and be sure not to depend on that file
being present.  It is easy to imagine a scenario in which
an administrator carelessly changes an entry so that the wrong
permission is granted if an :optinclude'd file was missing.
.SH FILES
.TP
.I @SUPERFILE@
The location of the
.I super.tab
file on your system.
.TP
.IR @TIMESTAMP_DIR@/ username
Default location of the file whose \fImtime\fR is used as the timestamp for the
last time the user entered his or her password for password-requiring
commands.  Check your installation for the directory used on your system.
.SH EXAMPLES
.ta 1i 4i
.HP
Example 1.
The control line
.sp
.in +.5i
.nf
doit /usr/local/bin/doit		\\
	me	\\
	you@{h1,h32}	\\
	ja.*:ok_j	\\
	:goodguys
.fi
.in -.5i
.sp
allows /usr/local/bin/doit to be run setuid-root by
.in +.5i
\(bu user
.B me
on any host,
.br
\(bu user
.B you
on hosts
.B h1
and
.BR h32 ;
.br
\(bu any users named
.B ja.*
in group
.BR ok_j ;
.br
\(bu and anybody in group
.BR goodguys .
.br
.in -.5i
.HP
Example 2.
The pair of control lines
.sp
.in +.5i
.nf
doit /usr/local/bin/doit		\\
	u+g=smith env=TZ,TAPE	\\
	password=y timeout=0	\\
	jo@PublicWorkstation

doit /usr/local/bin/doit		\\
	u+g=smith env=TZ,TAPE	\\
	jo
.fi
.in -.5i
.sp
allows user
.B jo
to run /usr/local/bin/doit with
uid\ =\ \fBsmith\fP,
gid\ =\ \fBsmith\fP's login gid, and keeping the environment variables
TZ and TAPE in addition to the standard set.
If user 
.B jo
is at
.BR PublicWorkstation ,
the first entry will match, requiring
jo's password every time the command is used; otherwise,
.I super
will match at the second entry, and no password is needed to run the command.
.HP
Example 3.
Here is an entry restricting CD-ROM mounting on different hosts:
.B tas
is the only user who may mount
CD's on
.BR elgar ;
anybody in group
.B xyz
may mount CD's on
.B alpha
or
.BR delta ;
and anybody on a host in the netgroup
.B india
may mount a CD on the
.B india
hosts.  However, user
.B jo
may never run \fIcdmount\fP, regardless of his or her group or host
(assuming that there is no overriding global pattern that permits
.B jo
to use the command).  Note that shell-style patterns are used,
not regex-style patterns.
.sp
.in +.5i
.nf
cdmount /usr/local/bin/cdmount		\\
	tas@elgar		\\
	:xyz@{alpha,delta}	\\
	*@+india		\\
	!jo

.fi
.in -.5i
.sp
.SH "SEE ALSO"
.BR super (1).