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
|
<chapter id='theRootFilesystem'><title>The Root Filesystem</title>
<section id='purpose2'>
<title>Purpose</title>
<para>The contents of the root filesystem must be adequate to boot,
restore, recover, and/or repair the system.</para>
<itemizedlist spacing="normal" mark="bullet">
<listitem>
<para>To boot a system, enough software and data must be present on the root partition
to mount other filesystems. This includes utilities, configuration,
boot loader information, and other essential start-up data.
<filename>/usr</filename>, <filename>/opt</filename>, and
<filename>/var</filename> are designed such that they may be located
on other partitions or filesystems.</para>
</listitem>
<listitem>
<para>To enable recovery and/or repair of a system, those utilities
needed by an experienced maintainer to diagnose and reconstruct a
damaged system must be present on the root filesystem.</para>
</listitem>
<listitem>
<para>To restore a system, those utilities needed to restore from
system backups (on floppy, tape, etc.) must be present on the root
filesystem.</para>
</listitem>
</itemizedlist>
<tip><title>Rationale</title>
<para>The minimum requirements for the root filesystem should be as
small as reasonably possible, but no smaller. While many users may
not want the extra complexity of a partitioned system, the option to
keep the root small should be preserved for several reasons:</para>
<itemizedlist>
<listitem>
<para>It is occasionally mounted from very small media.</para>
</listitem>
<listitem>
<para>The root filesystem contains many system-specific configuration
files. Possible examples include a kernel that is specific to the
system, a specific hostname, etc. This means that the root filesystem
isn't always shareable between networked systems. Keeping it small on
servers in networked systems minimizes the amount of lost space for
areas of unshareable files. It also allows workstations with smaller
local hard drives.</para>
</listitem>
<listitem>
<para>While you may have the root filesystem on a large partition, and
may be able to fill it to your heart's content, there will be people
with smaller partitions. If you have more files installed, you may
find incompatibilities with other systems using root filesystems on
smaller partitions. If you are a developer then you may be turning
your assumption into a problem for a large number of users.</para>
</listitem>
<listitem>
<para>Disk errors that corrupt data on the root filesystem are a
greater problem than errors on any other partition. A small root
filesystem is less prone to corruption as the result of a system
crash.</para>
</listitem>
</itemizedlist>
<para>These considerations must be balanced against the need for a
minimally useful operating environment, for the sake of the boot
process as well as in failure recovery situations.</para>
</tip>
<para>Applications must never create or require special files or
subdirectories in the root directory. Other locations in the FHS
hierarchy provide more than enough flexibility for any package.</para>
<tip><title>Rationale</title>
<para>There are several reasons why creating a new subdirectory of
the root filesystem is prohibited:</para>
<itemizedlist spacing="normal" mark="bullet">
<listitem>
<para>It demands space on a root partition which the system
administrator may want kept small and simple for either performance or
security reasons.</para>
</listitem>
<listitem>
<para>It evades whatever discipline the system administrator may have
set up for distributing standard file hierarchies across mountable
volumes.</para>
</listitem>
</itemizedlist>
<para>Distributions should not create new directories in the root
hierarchy without extremely careful consideration of the consequences
including for application portability.</para>
</tip>
</section>
<section id='requirements'><title>Requirements</title>
<para>The following directories, or symbolic links to directories, are
required in <filename>/</filename>.</para>
<informaltable frame='none'>
<tgroup cols='2' align='left'>
<thead>
<row>
<entry>Directory</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><filename>bin</filename></entry>
<entry>Essential command binaries</entry>
</row>
<row>
<entry><filename>boot</filename></entry>
<entry>Static files of the boot loader</entry>
</row>
<row>
<entry><filename>dev</filename></entry>
<entry>Device files</entry>
</row>
<row>
<entry><filename>etc</filename></entry>
<entry>Host-specific system configuration</entry>
</row>
<row>
<entry><filename>lib</filename></entry>
<entry>Essential shared libraries and kernel modules</entry>
</row>
<row>
<entry><filename>media</filename></entry>
<entry>Mount point for removable media</entry>
</row>
<row>
<entry><filename>mnt</filename></entry>
<entry>Mount point for mounting a filesystem temporarily</entry>
</row>
<row>
<entry><filename>opt</filename></entry>
<entry>Add-on application software packages</entry>
</row>
<row>
<entry><filename>run</filename></entry>
<entry>Data relevant to running processes</entry>
</row>
<row>
<entry><filename>sbin</filename></entry>
<entry>Essential system binaries</entry>
</row>
<row>
<entry><filename>srv</filename></entry>
<entry>Data for services provided by this system</entry>
</row>
<row>
<entry><filename>tmp</filename></entry>
<entry>Temporary files</entry>
</row>
<row>
<entry><filename>usr</filename></entry>
<entry>Secondary hierarchy</entry>
</row>
<row>
<entry><filename>var</filename></entry>
<entry>Variable data</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>Each directory listed above is specified in detail in separate
subsections below. <filename>/usr</filename> and
<filename>/var</filename> each has a complete section in this
document due to the complexity of those directories.</para>
</section>
<section id='specificOptions'><title>Specific Options</title>
<para>The following directories, or symbolic links to directories,
must be in <filename>/</filename>, if the corresponding subsystem is
installed:</para>
<informaltable frame='none'>
<tgroup cols='2' align='left'>
<thead>
<row>
<entry>Directory</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><filename>home</filename></entry>
<entry>User home directories (optional)</entry>
</row>
<row>
<entry><filename>lib<replaceable><qual></replaceable></filename></entry>
<entry>Alternate format essential shared libraries (optional)</entry>
</row>
<row>
<entry><filename>root</filename></entry>
<entry>Home directory for the root user (optional)</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>Each directory listed above is specified in detail in separate
subsections below.</para>
</section>
<section id='binEssentialUserCommandBinaries'>
<title>/bin : Essential user command binaries (for use by all users)</title>
<section id='purpose3'><title>Purpose</title>
<para><filename>/bin</filename> contains commands that may be used by
both the system administrator and by users, but which are required
when no other filesystems are mounted (e.g. in single user mode). It
may also contain commands which are used indirectly by scripts.
<footnote>
<para>
Command binaries that are not essential enough to place into
<filename>/bin</filename> must be placed in
<filename>/usr/bin</filename>, instead. Items that are required only
by non-root users (the X Window System, <filename>chsh</filename>,
etc.) are generally not essential enough to be placed into the root
partition.
</para>
</footnote>
</para>
</section>
<section id='requirements2'><title>Requirements</title>
<para>There must be no subdirectories in <filename>/bin</filename>.</para>
<para>The following commands, or symbolic links to commands, are
required in <filename>/bin</filename>:</para>
<informaltable pgwide='0' frame='none'>
<tgroup cols='2' align='left'>
<thead>
<row><entry>Command</entry><entry>Description</entry></row>
</thead>
<tbody>
<row>
<entry><command>cat</command></entry>
<entry>Utility to concatenate files to standard output</entry>
</row>
<row>
<entry><command>chgrp</command></entry>
<entry>Utility to change file group ownership</entry>
</row>
<row>
<entry><command>chmod</command></entry>
<entry>Utility to change file access permissions</entry>
</row>
<row>
<entry><command>chown</command></entry>
<entry>Utility to change file owner and group</entry>
</row>
<row>
<entry><command>cp</command></entry>
<entry>Utility to copy files and directories</entry>
</row>
<row>
<entry><command>date</command></entry>
<entry>Utility to print or set the system data and time</entry>
</row>
<row>
<entry><command>dd</command></entry>
<entry>Utility to convert and copy a file</entry>
</row>
<row>
<entry><command>df</command></entry>
<entry>Utility to report filesystem disk space usage</entry>
</row>
<row>
<entry><command>dmesg</command></entry>
<entry>Utility to print or control the kernel message buffer</entry>
</row>
<row>
<entry><command>echo</command></entry>
<entry>Utility to display a line of text</entry>
</row>
<row>
<entry><command>false</command></entry>
<entry>Utility to do nothing, unsuccessfully</entry>
</row>
<row>
<entry><command>hostname</command></entry>
<entry>Utility to show or set the system's host name</entry>
</row>
<row>
<entry><command>kill</command></entry>
<entry>Utility to send signals to processes</entry>
</row>
<row>
<entry><command>ln</command></entry>
<entry>Utility to make links between files</entry>
</row>
<row>
<entry><command>login</command></entry>
<entry>Utility to begin a session on the system</entry>
</row>
<row>
<entry><command>ls</command></entry>
<entry>Utility to list directory contents</entry>
</row>
<row>
<entry><command>mkdir</command></entry>
<entry>Utility to make directories</entry>
</row>
<row>
<entry><command>mknod</command></entry>
<entry>Utility to make block or character special files</entry>
</row>
<row>
<entry><command>more</command></entry>
<entry>Utility to page through text</entry>
</row>
<row>
<entry><command>mount</command></entry>
<entry>Utility to mount a filesystem</entry>
</row>
<row>
<entry><command>mv</command></entry>
<entry>Utility to move/rename files</entry>
</row>
<row>
<entry><command>ps</command></entry>
<entry>Utility to report process status</entry>
</row>
<row>
<entry><command>pwd</command></entry>
<entry>Utility to print name of current working directory</entry>
</row>
<row>
<entry><command>rm</command></entry>
<entry>Utility to remove files or directories</entry>
</row>
<row>
<entry><command>rmdir</command></entry>
<entry>Utility to remove empty directories</entry>
</row>
<row>
<entry><command>sed</command></entry>
<entry>The `sed' stream editor</entry>
</row>
<row>
<entry><command>sh</command></entry>
<entry>POSIX compatible command shell</entry>
</row>
<row>
<entry><command>stty</command></entry>
<entry>Utility to change and print terminal line settings</entry>
</row>
<row>
<entry><command>su</command></entry>
<entry>Utility to change user ID</entry>
</row>
<row>
<entry><command>sync</command></entry>
<entry>Utility to flush filesystem buffers</entry>
</row>
<row>
<entry><command>true</command></entry>
<entry>Utility to do nothing, successfully</entry>
</row>
<row>
<entry><command>umount</command></entry>
<entry>Utility to unmount file systems</entry>
</row>
<row>
<entry><command>uname</command></entry>
<entry>Utility to print system information</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>If <command>/bin/sh</command> is not the POSIX compatible shell
command itself, it must be a hard or symbolic link to the real shell
command.</para>
<para>The <command>[</command> and <command>test</command>
commands must be placed together in either <filename>/bin</filename>
or <filename>/usr/bin</filename>.</para>
<tip><title>Rationale</title>
<para>Various shells behave differently when called as
<command>sh</command>, so as to preserve POSIX compatibility while
allowing changes or extensions to POSIX when desired.</para>
<para>The requirement for the <command>[</command> and
<command>test</command> commands to be included as binaries (even if
implemented internally by the shell) is shared with the POSIX.1-2008
standard.</para>
</tip>
</section>
<section id='specificOptions2'><title>Specific Options</title>
<para>The following programs, or symbolic links to programs, must be
in <filename>/bin</filename> if the corresponding subsystem is
installed:</para>
<informaltable pgwide='0' frame='none'>
<tgroup cols='2' align='left'>
<thead>
<row><entry>Command</entry><entry>Description</entry></row>
</thead>
<tbody>
<row>
<entry><command>csh</command></entry>
<entry>The C shell (optional)</entry>
</row>
<row>
<entry><command>ed</command></entry>
<entry>The `ed' editor (optional)</entry>
</row>
<row>
<entry><command>tar</command></entry>
<entry>The tar archiving utility (optional)</entry>
</row>
<row>
<entry><command>cpio</command></entry>
<entry>The cpio archiving utility (optional)</entry>
</row>
<row>
<entry><command>gzip</command></entry>
<entry>The GNU compression utility (optional)</entry>
</row>
<row>
<entry><command>gunzip</command></entry>
<entry>The GNU uncompression utility (optional)</entry>
</row>
<row>
<entry><command>zcat</command></entry>
<entry>The GNU uncompression utility (optional)</entry>
</row>
<row>
<entry><command>netstat</command></entry>
<entry>The network statistics utility (optional)</entry>
</row>
<row>
<entry><command>ping</command></entry>
<entry>The ICMP network test utility (optional)</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para><command>/bin/csh</command> may be a symbolic link to
<command>/bin/tcsh</command> or
<command>/usr/bin/tcsh</command>.</para>
<tip><title>Rationale</title>
<para>The <command>tar</command>, <command>gzip </command>
and <command>cpio</command>
commands have been added to make restoration of a
system possible (provided that <filename>/</filename> is intact).</para>
<para>Conversely, if no restoration from the root partition is ever
expected, then these binaries might be omitted (e.g., a ROM chip root,
mounting <filename>/usr</filename> through NFS). If restoration of a
system is planned through the network, then <command>ftp</command>
or <command>tftp</command> (along with everything necessary to get
an ftp connection) must be available on the root partition.</para>
</tip>
</section>
</section>
<section id='bootStaticFilesOfTheBootLoader'>
<title>/boot : Static files of the boot loader</title>
<section id='purpose4'><title>Purpose</title>
<para>This directory contains everything required for the boot process
except configuration files not needed at boot time and the map
installer. Thus <filename>/boot</filename> stores data that is used
before the kernel begins executing user-mode programs. This may
include saved master boot sectors and sector map files.</para>
<para> Programs necessary to arrange for the boot loader to be able to
boot a file must be placed in <filename>/sbin</filename>.
Configuration files for boot loaders that are not required at boot
time must be placed in <filename>/etc</filename>.</para>
</section>
<section id='specificOptions3'><title>Specific Options</title>
<para>The operating system kernel must be located in either
<filename>/</filename> or <filename>/boot</filename>.</para>
<para>Certain architectures may have other requirements for
<filename>/boot</filename> related to limitations or expectations
specific to that architecture. These requirements are not enumerated
here; distributions are allowed to add requirements as needed to
enable system startup on these architectures.</para>
</section>
</section>
<section id='devDeviceFiles'><title>/dev : Device files</title>
<section id='purpose5'><title>Purpose</title>
<para>The <filename>/dev</filename> directory is the location of
special or device files.</para>
</section>
<section id='specificOptions4'><title>Specific Options</title>
<para>If it is possible that devices in <filename>/dev</filename> will
need to be manually created, <filename>/dev</filename> must contain a
command named <filename>MAKEDEV</filename>, which can create devices
as needed. It may also contain a <filename>MAKEDEV.local</filename>
for any local devices.</para>
<para>If required, <filename>MAKEDEV</filename> must have provisions
for creating any device that may be found on the system, not just
those that a particular distribution installs.</para>
</section>
</section>
<section id='etcHostspecificSystemConfiguration'>
<title>/etc : Host-specific system configuration</title>
<section id='purpose6'>
<title>Purpose</title>
<para>The <filename>/etc</filename> hierarchy contains configuration
files. A "configuration file" is a local file used to control the
operation of a program; it must be static and cannot be an executable
binary.
<footnote>
<para>
To be clear, <filename>/etc</filename> may contain executable scripts,
such as the command scripts commonly called by
<filename>init</filename> to start and shut down the system and start
daemon processes. "Executable binary" in this context refers to
direct machine code or pseudocode not in a human-readable format, such
as native ELF executables.
</para>
</footnote>
</para>
<para>
It is recommended that files be stored in subdirectories of
<filename>/etc</filename> rather than directly in
<filename>/etc</filename>.
</para>
</section>
<section id='requirements3'><title>Requirements</title>
<para>No binaries may be located under
<filename>/etc</filename>.</para>
<para>The following directories, or symbolic links to directories are
required in <filename>/etc</filename>:</para>
<informaltable frame='none'>
<tgroup cols='2' align='left'>
<thead>
<row>
<entry>Directory</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry>opt</entry>
<entry>Configuration for /opt</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</section>
<section id='specificOptions5'><title>Specific Options</title>
<para>The following directories, or symbolic links to directories must
be in <filename>/etc</filename>, if the corresponding subsystem is
installed:</para>
<informaltable frame='none'>
<tgroup cols='2' align='left'>
<thead>
<row>
<entry>Directory</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry>X11</entry>
<entry>Configuration for the X Window system (optional)</entry>
</row>
<row>
<entry>sgml</entry>
<entry>Configuration for SGML (optional)</entry>
</row>
<row>
<entry>xml</entry>
<entry>Configuration for XML (optional)</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>The following files, or symbolic links to files, must be in
<filename>/etc</filename> if the corresponding subsystem is
installed:
<footnote>
<para>
Systems that use the shadow password suite will have additional
configuration files in <filename>/etc</filename>
(<filename>/etc/shadow</filename> and others) and programs in
<filename>/usr/sbin</filename> (<command>useradd</command>,
<command>usermod</command>, and others).
</para>
</footnote>
</para>
<informaltable frame='none'>
<tgroup cols='2' align='left'>
<thead>
<row><entry>File</entry><entry>Description</entry></row>
</thead>
<tbody>
<row>
<entry><filename>csh.login</filename></entry>
<entry>Systemwide initialization file for C shell logins (optional)</entry>
</row>
<row>
<entry><filename>exports</filename></entry>
<entry>NFS filesystem access control list (optional)</entry>
</row>
<row>
<entry><filename>fstab</filename></entry>
<entry>Static information about filesystems (optional)</entry>
</row>
<row>
<entry><filename>ftpusers</filename></entry>
<entry>FTP daemon user access control list (optional)</entry>
</row>
<row>
<entry><filename>gateways</filename></entry>
<entry>File which lists gateways for routed (optional)</entry>
</row>
<row>
<entry><filename>gettydefs</filename></entry>
<entry>Speed and terminal settings used by getty (optional)</entry>
</row>
<row>
<entry><filename>group</filename></entry>
<entry>User group file (optional)</entry>
</row>
<row>
<entry><filename>host.conf</filename></entry>
<entry>Resolver configuration file (optional)</entry>
</row>
<row>
<entry><filename>hosts</filename></entry>
<entry>Static information about host names (optional)</entry>
</row>
<row>
<entry><filename>hosts.allow</filename></entry>
<entry>Host access file for TCP wrappers (optional)</entry>
</row>
<row>
<entry><filename>hosts.deny</filename></entry>
<entry>Host access file for TCP wrappers (optional)</entry>
</row>
<row>
<entry><filename>hosts.equiv</filename></entry>
<entry>List of trusted hosts for rlogin, rsh, rcp (optional)</entry>
</row>
<row>
<entry><filename>hosts.lpd</filename></entry>
<entry>List of trusted hosts for lpd (optional)</entry>
</row>
<row>
<entry><filename>inetd.conf</filename></entry>
<entry>Configuration file for inetd (optional)</entry>
</row>
<row>
<entry><filename>inittab</filename></entry>
<entry>Configuration file for init (optional)</entry>
</row>
<row>
<entry><filename>issue</filename></entry>
<entry>Pre-login message and identification file (optional)</entry>
</row>
<row>
<entry><filename>ld.so.conf</filename></entry>
<entry>List of extra directories to search for shared libraries (optional)</entry>
</row>
<row>
<entry><filename>motd</filename></entry>
<entry>Post-login message of the day file (optional)</entry>
</row>
<row>
<entry><filename>mtab</filename></entry>
<entry>Dynamic information about filesystems (optional)</entry>
</row>
<row>
<entry><filename>mtools.conf</filename></entry>
<entry>Configuration file for mtools (optional)</entry>
</row>
<row>
<entry><filename>networks</filename></entry>
<entry>Static information about network names (optional)</entry>
</row>
<row>
<entry><filename>passwd</filename></entry>
<entry>The password file (optional)</entry>
</row>
<row>
<entry><filename>printcap</filename></entry>
<entry>The lpd printer capability database (optional)</entry>
</row>
<row>
<entry><filename>profile</filename></entry>
<entry>Systemwide initialization file for sh shell logins (optional)</entry>
</row>
<row>
<entry><filename>protocols</filename></entry>
<entry>IP protocol listing (optional)</entry>
</row>
<row>
<entry><filename>resolv.conf</filename></entry>
<entry>Resolver configuration file (optional)</entry>
</row>
<row>
<entry><filename>rpc</filename></entry>
<entry>RPC protocol listing (optional)</entry>
</row>
<row>
<entry><filename>securetty</filename></entry>
<entry>TTY access control for root login (optional)</entry>
</row>
<row>
<entry><filename>services</filename></entry>
<entry>Port names for network services (optional)</entry>
</row>
<row>
<entry><filename>shells</filename></entry>
<entry>Pathnames of valid login shells (optional)</entry>
</row>
<row>
<entry><filename>syslog.conf</filename></entry>
<entry>Configuration file for syslogd (optional)</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para><filename>mtab</filename> does not fit the static nature of
<filename>/etc</filename>: it is excepted for historical reasons.
<footnote>
<para>
On some Linux systems, this may be a symbolic link to
<filename>/proc/mounts</filename>, in which case this exception is not
required.
</para>
</footnote>
</para>
</section>
<section id='etcoptConfigurationFilesForOpt'>
<title>/etc/opt : Configuration files for /opt</title>
<section id='purpose7'><title>Purpose</title>
<para>Host-specific configuration files for add-on application
software packages must be installed within the directory
<filename>/etc/opt/<subdir></filename>, where
<filename><subdir></filename> is the name of the subtree in
<filename>/opt</filename> where the static data from that package is
stored.</para>
</section>
<section id='requirements4'><title>Requirements</title>
<para>No structure is imposed on the internal arrangement of
<filename>/etc/opt/<subdir></filename>.</para>
<para>If a configuration file must reside in a different location in
order for the package or system to function properly, it may be placed
in a location other than
<filename>/etc/opt/<subdir></filename>.</para>
<tip><title>Rationale</title>
<para>Refer to the rationale for <filename>/opt</filename>.</para>
</tip>
</section>
</section>
<section id='etcx11ConfigurationForTheXWindowS'>
<title>/etc/X11 : Configuration for the X Window System (optional)</title>
<section id='purpose8'><title>Purpose</title>
<para><emphasis>/etc/X11</emphasis> is the location for all X11
host-specific configuration. This directory is necessary to allow
local control if <emphasis>/usr</emphasis> is mounted read
only.</para>
</section>
<section id='specificOptions6'><title>Specific Options</title>
<para>The following files, or symbolic links to files, must be in
<filename>/etc/X11</filename> if the corresponding subsystem is
installed:</para>
<informaltable frame='none'>
<tgroup cols='2' align='left'>
<colspec colname='c1'/>
<colspec colname='c2'/>
<thead>
<row>
<entry>File</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><filename>xorg.conf</filename></entry>
<entry>The configuration file for X.org versions 7 and later (optional)</entry>
</row>
<row>
<entry><filename>Xmodmap</filename></entry>
<entry>Global X11 keyboard modification file (optional)</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>Subdirectories of <filename>/etc/X11</filename> may include
those for <filename>xdm</filename> and for any other programs (some
window managers, for example) that need them.
<footnote>
<para>
<filename>/etc/X11/xdm</filename> holds the configuration files for
<filename>xdm</filename>. These are most of the files previously
found in <filename>/usr/lib/X11/xdm</filename>. Some local variable
data for <filename>xdm</filename> is stored in
<filename>/var/lib/xdm</filename>.
</para>
</footnote>
</para>
</section>
</section>
<section id='etcsgmlConfigurationFilesForSgmlAn'>
<title>/etc/sgml : Configuration files for SGML (optional)</title>
<section id='purpose9'><title>Purpose</title>
<para>Generic configuration files defining high-level parameters of
the SGML systems are installed here. Files with names
<filename>*.conf</filename> indicate generic configuration files.
File with names <filename>*.cat</filename> are the DTD-specific
centralized catalogs, containing references to all other catalogs
needed to use the given DTD. The super catalog file
<filename>catalog</filename> references all the centralized
catalogs.</para>
</section>
</section>
<section>
<title>/etc/xml : Configuration files for XML (optional)</title>
<section><title>Purpose</title>
<para>Generic configuration files defining high-level parameters of
the XML systems are installed here. Files with names
<filename>*.conf</filename> indicate generic configuration files.
The super catalog file
<filename>catalog</filename> references all the centralized
catalogs.</para>
</section>
</section>
</section>
<section id='homeUserHomeDirectories'>
<title>/home : User home directories (optional)</title>
<section id='purpose10'><title>Purpose</title>
<para><filename>/home</filename> is a fairly standard concept, but it
is clearly a site-specific filesystem.
<footnote>
<para>
Different people prefer to place user accounts in a variety of places.
This section describes only a suggested placement for user home
directories; nevertheless we recommend that all FHS-compliant
distributions use this as the default location for user home
directories. Non-login accounts created for administrative
purposes often have their home directories elsewhere.</para>
<para>On smaller systems, each user's home directory is typically implemented
as a subdirectory directly under <filename>/home</filename>, for example
<filename>/home/smith</filename>, <filename>/home/torvalds</filename>,
<filename>/home/operator</filename>, etc. On large systems
(especially when the <filename>/home</filename> directories are shared
amongst many hosts using NFS) it is useful to subdivide user home
directories. Subdivision may be accomplished by using subdirectories
such as <filename>/home/staff</filename>,
<filename>/home/guests</filename>,
<filename>/home/students</filename>, etc.
</para>
</footnote>
The setup will differ from host to host. Therefore, no program should
assume any specific location for a home directory, rather it
should query for it.
<footnote>
<para>
To find a user's home directory, use a library function such
as <function>getpwent</function>,
<function>getpwent_r</function> of
<function>fgetpwent</function> rather than relying
on <filename>/etc/passwd</filename> because user information may be
stored remotely using systems such as NIS.
</para>
</footnote>
</para>
</section>
<section id='requirements4a'><title>Requirements</title>
<para>
User specific configuration files for applications are stored in the
user's home directory in a file that starts with the '.' character (a
"dot file"). If an application needs to create more than one dot file
then they should be placed in a subdirectory with a name starting with
a '.' character, (a "dot directory"). In this case the configuration
files should not start with the '.' character.
<footnote>
<para>
It is recommended that, apart from autosave and lock files, programs
should refrain from creating non dot files or directories in a home
directory without user consent.
</para>
</footnote>
</para>
</section>
<section id='homeReferences'><title>Home Directory Specifications and Conventions</title>
<para>
A number of efforts have been made in the past to standardize
the layout of home directories,
including the XDG Base Directories specification
<footnote>
<para>Found at
<ulink url="http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html" />
and
<ulink url="http://www.freedesktop.org/wiki/Software/xdg-user-dirs" />.
</para>
</footnote>
and the GLib conventions on user directory contents.
<footnote>
<para>A description of GLib's conventions can be found in the
documentation for GUserDirectory, at
<ulink url="http://developer.gnome.org/glib/unstable/glib-Miscellaneous-Utility-Functions.html#GUserDirectory" />.
</para>
</footnote>
Additional efforts in this direction are possible in the future.
To accomodate software which makes use of these specifications and conventions,
distributions may create directory hierarchies which follow
the specifications and conventions. Those directory hierarchies may be located
underneath home directories.
</para>
</section>
</section>
<section id='libEssentialSharedLibrariesAndKern'>
<title>/lib : Essential shared libraries and kernel modules</title>
<section id='purpose11'><title>Purpose</title>
<para>The <filename>/lib</filename> directory contains those shared
library images needed to boot the system and run the commands in the
root filesystem, ie. by binaries in <filename>/bin</filename> and
<filename>/sbin</filename>.
<footnote>
<para>
Shared libraries that are only necessary for binaries in
<filename>/usr</filename> (such as any X Window binaries) must not be
in <filename>/lib</filename>. Only the shared libraries required to
run binaries in <filename>/bin</filename> and
<filename>/sbin</filename> may be here. In particular, the library
<filename>libm.so.*</filename> may also be placed in
<filename>/usr/lib</filename> if it is not required by anything in
<filename>/bin</filename> or <filename>/sbin</filename>.
</para>
</footnote>
</para>
</section>
<section id='requirements5'><title>Requirements</title>
<para>At least one of each of the following filename patterns are
required (they may be files, or symbolic links):</para>
<informaltable pgwide='0' frame='none'>
<tgroup cols='2' align='left'>
<thead>
<row>
<entry>File</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><filename>libc.so.*</filename></entry>
<entry>The dynamically-linked C library (optional)</entry>
</row>
<row>
<entry><filename>ld*</filename></entry>
<entry>The execution time linker/loader (optional)</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>If a C preprocessor is installed, <emphasis>/lib/cpp</emphasis>
must be a reference to it, for historical reasons.
<footnote>
<para>
The usual placement of this binary is <filename>/usr/bin/cpp</filename>.
</para>
</footnote>
</para>
</section>
<section id='specificOptions7'><title>Specific Options</title>
<para>The following directories, or symbolic links to directories,
must be in <filename>/lib</filename>, if the corresponding subsystem
is installed:</para>
<informaltable frame='none'>
<tgroup cols='2' align='left'>
<thead>
<row>
<entry>Directory</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><filename>modules</filename></entry>
<entry>Loadable kernel modules (optional)</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</section>
</section>
<section id='libltqualgtAlternateFormatEssential'>
<title>/lib<replaceable><qual></replaceable> : Alternate format essential shared libraries (optional)</title>
<section id='purpose12'><title>Purpose</title>
<para>There may be one or more variants of the
<filename>/lib</filename> directory on systems which support more than
one binary format requiring separate libraries.
<footnote>
<para>
This is commonly used for 64-bit or 32-bit support on
systems which support multiple binary formats, but require libraries
of the same name. In this case, <filename>/lib32</filename> and
<filename>/lib64</filename> might be the library directories, and
<filename>/lib</filename> a symlink to one of them.
</para>
</footnote>
</para>
</section>
<section id='requirements6'><title>Requirements</title>
<para>If one or more of these directories exist, the requirements for
their contents are the same as the normal <filename>/lib</filename>
directory, except that <filename>/lib<replaceable><qual></replaceable>/cpp</filename> is
not required.
<footnote>
<para>
<filename>/lib<replaceable><qual></replaceable>/cpp</filename> is still permitted: this
allows the case where <filename>/lib</filename> and
<filename>/lib<replaceable><qual></replaceable></filename> are the same (one is a symbolic
link to the other). </para> </footnote></para>
</section>
</section>
<section id='mediaMountPoint'>
<title>/media : Mount point for removable media</title>
<section id='purposeMediaMountPoint'><title>Purpose</title>
<para>This directory contains subdirectories which are used as mount
points for removable media such as floppy disks, cdroms and zip
disks.</para>
<tip><title>Rationale</title>
<para>Historically there have been a number of other different places
used to mount removable media such as <filename>/cdrom</filename>,
<filename>/mnt</filename> or <filename>/mnt/cdrom</filename>. Placing
the mount points for all removable media directly in the root
directory would potentially result in a large number of extra
directories in <filename>/</filename>. Although the use of
subdirectories in <filename>/mnt</filename> as a mount point has
recently been common, it conflicts with a much older tradition of
using <filename>/mnt</filename> directly as a temporary mount point.
</para>
</tip>
</section>
<section id='specificOptionsMediaMount'><title>Specific Options</title>
<para>The following directories, or symbolic links to directories,
must be in <filename>/media</filename>, if the corresponding subsystem
is installed:</para>
<informaltable frame='none'>
<tgroup cols='2' align='left'>
<thead>
<row>
<entry>Directory</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><filename>floppy</filename></entry>
<entry>Floppy drive (optional)</entry>
</row>
<row>
<entry><filename>cdrom</filename></entry>
<entry>CD-ROM drive (optional)</entry>
</row>
<row>
<entry><filename>cdrecorder</filename></entry>
<entry>CD writer (optional)</entry>
</row>
<row>
<entry><filename>zip</filename></entry>
<entry>Zip drive (optional)</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>On systems where more than one device exists for mounting a
certain type of media, mount directories can be created by appending a
digit to the name of those available above starting with '0', but the
unqualified name must also exist.
<footnote>
<para>
A compliant distribution with two CDROM drives might have
<filename>/media/cdrom0</filename> and
<filename>/media/cdrom1</filename> with
<filename>/media/cdrom</filename> a symlink to either of these.
</para>
</footnote>
</para>
</section>
</section>
<section id='mntMountPointForATemporarilyMount'>
<title>/mnt : Mount point for a temporarily mounted filesystem</title>
<section id='purpose13'><title>Purpose</title>
<para>This directory is provided so that the system administrator may
temporarily mount a filesystem as needed. The content of this
directory is a local issue and should not affect the manner in which
any program is run.</para>
<para>This directory must not be used by installation programs: a
suitable temporary directory not in use by the system must be used
instead.</para>
</section>
</section>
<section id='optAddonApplicationSoftwarePackages'>
<title>/opt : Add-on application software packages</title>
<section id='purpose14'><title>Purpose</title>
<para><filename>/opt</filename> is reserved for the installation of
add-on application software packages.</para>
<para>A package to be installed in <filename>/opt</filename> must
locate its static files in a separate
<filename>/opt/<package></filename> or
<filename>/opt/<provider></filename> directory
tree, where <filename><package></filename> is a name that
describes the software package and
<filename><provider></filename> is the provider's LANANA
registered name.</para>
</section>
<section id='requirements7'><title>Requirements</title>
<informaltable frame='none'>
<tgroup cols='2' align='left'>
<thead>
<row>
<entry>Directory</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><package></entry>
<entry>Static package objects</entry>
</row>
<row>
<entry><provider></entry>
<entry>LANANA registered provider name</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>The directories <filename>/opt/bin</filename>,
<filename>/opt/doc</filename>, <filename>/opt/include</filename>,
<filename>/opt/info</filename>, <filename>/opt/lib</filename>, and
<filename>/opt/man</filename> are reserved for local system
administrator use. Packages may provide "front-end" files intended to
be placed in (by linking or copying) these reserved directories by the
local system administrator, but must function normally in the absence
of these reserved directories.</para>
<para>Programs to be invoked by users must be located in the directory
<filename>/opt/<package>/bin</filename> or under the
<filename>/opt/<provider></filename> hierarchy. If the package
includes UNIX manual pages, they must be located in
<filename>/opt/<package>/share/man</filename> or under the
<filename>/opt/<provider></filename> hierarchy, and the same
substructure as <filename>/usr/share/man</filename> must be
used.</para>
<para>Package files that are variable (change in normal operation)
must be installed in <filename>/var/opt</filename>. See the section
on <filename>/var/opt</filename> for more information.</para>
<para>Host-specific configuration files must be installed in
<filename>/etc/opt</filename>. See the section on
<filename>/etc</filename> for more information.</para>
<para>No other package files may exist outside the
<filename>/opt</filename>, <filename>/var/opt</filename>, and
<filename>/etc/opt</filename> hierarchies except for those package
files that must reside in specific locations within the filesystem
tree in order to function properly. For example, device lock files
must be placed in <filename>/var/lock</filename> and devices must be
located in <filename>/dev</filename>.</para>
<para>Distributions may install and otherwise manage software in
<filename>/opt</filename> under an appropriately registered
subdirectory.</para>
<tip><title>Rationale</title>
<para>The use of <filename>/opt</filename> for add-on software is a
well-established practice in the UNIX community. The System V
Application Binary Interface [AT&T 1990], based on the System V
Interface Definition (Third Edition), provides for an
<filename>/opt</filename> structure very similar to the one defined
here.</para>
<para>The Intel Binary Compatibility Standard v. 2 (iBCS2) also
provides a similar structure for <filename>/opt</filename>.</para>
<para>Generally, all data required to support a package on a system
must be present within <filename>/opt/<package></filename>,
including files intended to be copied into
<filename>/etc/opt/<package></filename> and
<filename>/var/opt/<package></filename> as well as reserved
directories in <filename>/opt</filename>.</para>
<para>The minor restrictions on distributions using
<filename>/opt</filename> are necessary because conflicts are possible
between distribution-installed and locally-installed software,
especially in the case of fixed pathnames found in some binary
software.</para>
<para>The structure of the directories below
<filename>/opt/<provider></filename> is left up to the packager
of the software, though it is recommended that packages are installed
in <filename>/opt/<provider>/<package></filename> and
follow a similar structure to the guidelines for
<filename>/opt/<package></filename>. A valid reason for diverging from
this structure is for support packages which may have files installed
in <filename>/opt/<provider>/lib</filename> or
<filename>/opt/<provider>/bin</filename>.</para>
</tip>
</section>
</section>
<section id='rootHomeDirectoryForTheRootUser'>
<title>/root : Home directory for the root user (optional)</title>
<section id='purpose15'><title>Purpose</title>
<para>The root account's home directory may be determined by developer
or local preference, but this is the recommended default
location.
<footnote><para>If the home directory of the root account is not
stored on the root partition it will be necessary to make certain it
will default to <filename>/</filename> if it cannot be
located.</para>
<para>We recommend against using the root account for tasks that can be
performed as an unprivileged user, and that it be used solely for system
administration. For this reason, we recommend that subdirectories for
mail and other applications not appear in the root account's home
directory, and that mail for administration roles such as root,
postmaster, and webmaster be forwarded to an appropriate user.
</para>
</footnote>
</para>
</section>
</section>
<section id='runRuntimeVariableData'>
<title>/run : Run-time variable data</title>
<section id='runPurpose'><title>Purpose</title>
<para>This directory contains system information data describing the
system since it was booted. Files under this directory must be
cleared (removed or truncated as appropriate) at the beginning of the
boot process.</para>
<para>The purposes of this directory were once served by
<filename>/var/run</filename>. In general, programs may continue to
use <filename>/var/run</filename> to fulfill the requirements set out
for <filename>/run</filename> for the purposes of backwards
compatibility. Programs which have migrated to use
<filename>/run</filename> should cease their usage of
<filename>/var/run</filename>, except as noted in the section on
<filename>/var/run</filename>.</para>
<para>Programs may have a subdirectory of
<filename>/run</filename>; this is encouraged for programs that
use more than one run-time file. Users may also have a subdirectory
of <filename>/run</filename>, although care must be taken to
appropriately limit access rights to prevent unauthorized use of
<filename>/run</filename> itself and other subdirectories.
<footnote>
<para>
<filename>/run</filename> should not be writable for unprivileged
users; it is a major security problem if any user can write in this
directory. User-specific subdirectories should be writable only by
each directory's owner.
</para>
</footnote>
</para>
</section>
<section id='runRequirements'><title>Requirements</title>
<para>
Process identifier (PID) files, which were originally placed in
<filename>/etc</filename>, must be placed in
<filename>/run</filename>. The naming convention for PID files is
<filename><program-name>.pid</filename>. For example, the
<command>crond</command> PID file is named
<filename>/run/crond.pid</filename>.</para>
<para>The internal format of PID files remains unchanged. The file
must consist of the process identifier in ASCII-encoded decimal,
followed by a newline character. For example, if
<command>crond</command> was process number 25,
<filename>/run/crond.pid</filename> would contain three characters:
two, five, and newline.</para>
<para>Programs that read PID files should be somewhat flexible in what
they accept; i.e., they should ignore extra whitespace, leading
zeroes, absence of the trailing newline, or additional lines in the
PID file. Programs that create PID files should use the simple
specification located in the above paragraph.</para>
<para>System programs that maintain transient UNIX-domain sockets must
place them in this directory or an appropriate subdirectory as
outlined above.</para>
</section>
</section>
<section id='sbinSystemBinaries'><title>/sbin : System binaries</title>
<section id='purpose16'><title>Purpose</title>
<para>Utilities used for system administration (and other root-only
commands) are stored in <filename>/sbin</filename>,
<filename>/usr/sbin</filename>, and
<filename>/usr/local/sbin</filename>. <filename>/sbin</filename>
contains binaries essential for booting, restoring, recovering, and/or
repairing the system in addition to the binaries in
<filename>/bin</filename>.
<footnote>
<para>
Originally, <filename>/sbin</filename> binaries were kept in
<filename>/etc</filename>.
</para></footnote>
Programs executed after
<filename>/usr</filename> is known to be mounted (when there are no
problems) are generally placed into <filename>/usr/sbin</filename>.
Locally-installed system administration programs should be placed into
<filename>/usr/local/sbin</filename>.
<footnote>
<para>Deciding what things go into
<emphasis>"sbin"</emphasis> directories is simple: if a normal (not a
system administrator) user will ever run it directly, then it must be
placed in one of the <emphasis>"bin"</emphasis> directories. Ordinary
users should not have to place any of the <filename>sbin</filename>
directories in their path.</para>
<para>For example, files such as <command>chfn</command> which users
only occasionally use must still be placed in
<filename>/usr/bin</filename>. <command>ping</command>, although it
is absolutely necessary for root (network recovery and diagnosis) is
often used by users and must live in <filename>/bin</filename> for
that reason.</para>
<para>We recommend that users have read and execute permission for
everything in <filename>/sbin</filename> except, perhaps, certain
setuid and setgid programs. The division between
<filename>/bin</filename> and <filename>/sbin</filename> was not
created for security reasons or to prevent users from seeing the
operating system, but to provide a good partition between binaries
that everyone uses and ones that are primarily used for administration
tasks. There is no inherent security advantage in making
<filename>/sbin</filename> off-limits for users.
</para>
</footnote></para>
</section>
<section id='requirements8'><title>Requirements</title>
<para>There must be no subdirectories in <filename>/sbin</filename>.</para>
<para>The following commands, or symbolic links to commands, are
required in <filename>/sbin</filename>:</para>
<informaltable pgwide='0' frame='none'>
<tgroup cols='2' align='left'>
<thead>
<row>
<entry>Command</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><command>shutdown</command></entry>
<entry>Command to bring the system down.</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</section>
<section id='specificOptions8'><title>Specific Options</title>
<para>The following files, or symbolic links to files, must be in
<filename>/sbin</filename> if the corresponding subsystem is
installed:</para>
<informaltable pgwide='0' frame='none'>
<tgroup cols='2' align='left'>
<colspec colname='c1'/>
<colspec colname='c2'/>
<thead>
<row><entry>Command</entry><entry>Description</entry></row>
</thead>
<tbody>
<row>
<entry><filename>fastboot</filename></entry>
<entry>Reboot the system without checking the disks (optional)</entry>
</row>
<row>
<entry><filename>fasthalt</filename></entry>
<entry>Stop the system without checking the disks (optional)</entry>
</row>
<row>
<entry><filename>fdisk</filename></entry>
<entry>Partition table manipulator (optional)</entry>
</row>
<row>
<entry><filename>fsck</filename></entry>
<entry>File system check and repair utility (optional)</entry>
</row>
<row>
<entry><filename>fsck.*</filename></entry>
<entry>File system check and repair utility for a specific filesystem (optional)</entry>
</row>
<row>
<entry><filename>getty</filename></entry>
<entry>The getty program (optional)</entry>
</row>
<row>
<entry><filename>halt</filename></entry>
<entry>Command to stop the system (optional)</entry>
</row>
<row>
<entry><filename>ifconfig</filename></entry>
<entry>Configure a network interface (optional)</entry>
</row>
<row>
<entry><filename>init</filename></entry>
<entry>Initial process (optional)</entry>
</row>
<row>
<entry><filename>mkfs</filename></entry>
<entry>Command to build a filesystem (optional)</entry>
</row>
<row>
<entry><filename>mkfs.*</filename></entry>
<entry>Command to build a specific filesystem (optional)</entry>
</row>
<row>
<entry><filename>mkswap</filename></entry>
<entry>Command to set up a swap area (optional)</entry>
</row>
<row>
<entry><filename>reboot</filename></entry>
<entry>Command to reboot the system (optional)</entry>
</row>
<row>
<entry><filename>route</filename></entry>
<entry>IP routing table utility (optional)</entry>
</row>
<row>
<entry><filename>swapon</filename></entry>
<entry>Enable paging and swapping (optional)</entry>
</row>
<row>
<entry><filename>swapoff</filename></entry>
<entry>Disable paging and swapping (optional)</entry>
</row>
<row>
<entry><filename>update</filename></entry>
<entry>Daemon to periodically flush filesystem buffers (optional)</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</section>
</section>
<section id='srvDataForServicesProvidedBySystem'>
<title>/srv : Data for services provided by this system</title>
<section id='purpose16a'>
<title>Purpose</title>
<para><filename>/srv</filename> contains site-specific data which is
served by this system.
<tip><title>Rationale</title>
<para>
This main purpose of specifying this is so that users may find the
location of the data files for a particular service, and so that
services which require a single tree for readonly data, writable data
and scripts (such as cgi scripts) can be reasonably placed. Data that
is only of interest to a specific user should go in that users' home
directory. If the directory and file structure of the data is not
exposed to consumers, it should go in <filename>/var/lib</filename>.
</para>
<para>
The methodology used to name subdirectories of
<filename>/srv</filename> is unspecified as there is currently no
consensus on how this should be done. One method for structuring data
under <filename>/srv</filename> is by protocol,
eg. <filename>ftp</filename>, <filename>rsync</filename>,
<filename>www</filename>, and <filename>cvs</filename>. On large
systems it can be useful to structure <filename>/srv</filename> by
administrative context, such as <filename>/srv/physics/www</filename>,
<filename>/srv/compsci/cvs</filename>, etc. This setup will differ
from host to host. Therefore, no program should rely on a specific
subdirectory structure of <filename>/srv</filename> existing or data
necessarily being stored in <filename>/srv</filename>. However
<filename>/srv</filename> should always exist on FHS compliant systems
and should be used as the default location for such data.
</para>
<para>
Distributions must take care not to remove locally placed files in
these directories without administrator permission.
<footnote>
<para>
This is particularly important as these areas will often contain both
files initially installed by the distributor, and those added by the
administrator.
</para>
</footnote>
</para>
</tip>
</para>
</section>
</section>
<section id='tmpTemporaryFiles'><title>/tmp : Temporary files</title>
<section id='purpose17'><title>Purpose</title>
<para>The <filename>/tmp</filename> directory must be made available
for programs that require temporary files.</para>
<para>Programs must not assume that any files or directories in
<filename>/tmp</filename> are preserved between invocations of the
program.</para>
<tip><title>Rationale</title>
<para>IEEE standard POSIX.1-2008 lists requirements
similar to the above section.</para>
<para>Although data stored in <filename>/tmp</filename> may be deleted
in a site-specific manner, it is recommended that files and
directories located in <filename>/tmp</filename> be deleted whenever
the system is booted.</para>
<para>FHS added this recommendation on the basis of historical
precedent and common practice, but did not make it a requirement
because system administration is not within the scope of this
standard.</para>
</tip>
</section>
</section>
</chapter>
|