/usr/share/debian-reference/ch04.en.html is in debian-reference-en 2.58.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Chapter 4. Authentication</title>
<link rel="stylesheet" type="text/css" href="debian-reference.css"/>
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<link rel="home" href="index.en.html" title="Debian Reference"/>
<link rel="up" href="index.en.html" title="Debian Reference"/>
<link rel="prev" href="ch03.en.html" title="Chapter 3. The system initialization"/>
<link rel="next" href="ch05.en.html" title="Chapter 5. Network setup"/>
</head>
<body>
<div class="navheader">
<table width="100%" summary="Navigation header">
<tr>
<th colspan="3" align="center">Chapter 4. Authentication</th>
</tr>
<tr>
<td align="left"><a accesskey="p" href="ch03.en.html"><img src="images/prev.png" alt="Prev"/></a> </td>
<th width="60%" align="center"> </th>
<td align="right"> <a accesskey="n" href="ch05.en.html"><img src="images/next.png" alt="Next"/></a></td>
</tr>
</table>
<hr/>
</div>
<div class="chapter">
<div class="titlepage">
<div>
<div>
<h1 class="title"><a id="_authentication"/>Chapter 4. Authentication</h1>
</div>
</div>
</div>
<div class="toc">
<p>
<strong>Table of Contents</strong>
</p>
<dl class="toc">
<dt>
<span class="section">
<a href="ch04.en.html#_normal_unix_authentication">4.1. Normal Unix authentication</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch04.en.html#_managing_account_and_password_information">4.2. Managing account and password information</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch04.en.html#_good_password">4.3. Good password</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch04.en.html#_creating_encrypted_password">4.4. Creating encrypted password</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch04.en.html#_pam_and_nss">4.5. PAM and NSS</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="ch04.en.html#_configuration_files_accessed_by_pam_and_nss">4.5.1. Configuration files accessed by PAM and NSS</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch04.en.html#_the_modern_centralized_system_management">4.5.2. The modern centralized system management</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch04.en.html#_why_gnu_su_does_not_support_the_wheel_group">4.5.3. "Why GNU su does not support the wheel group"</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch04.en.html#_stricter_password_rule">4.5.4. Stricter password rule</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="ch04.en.html#_other_access_controls">4.6. Other access controls</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="ch04.en.html#_sudo">4.6.1. sudo</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch04.en.html#_policykit">4.6.2. PolicyKit</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch04.en.html#_selinux">4.6.3. SELinux</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch04.en.html#_restricting_access_to_some_server_services">4.6.4. Restricting access to some server services</a>
</span>
</dt>
</dl>
</dd>
<dt>
<span class="section">
<a href="ch04.en.html#_security_of_authentication">4.7. Security of authentication</a>
</span>
</dt>
<dd>
<dl>
<dt>
<span class="section">
<a href="ch04.en.html#_secure_password_on_the_internet">4.7.1. Secure password on the Internet</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch04.en.html#_secure_shell">4.7.2. Secure Shell</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch04.en.html#_extra_security_measures_for_the_internet">4.7.3. Extra security measures for the Internet</a>
</span>
</dt>
<dt>
<span class="section">
<a href="ch04.en.html#_securing_the_root_password">4.7.4. Securing the root password</a>
</span>
</dt>
</dl>
</dd>
</dl>
</div>
<p>When a person (or a program) requests access to the system, authentication confirms the identity to be a trusted one.</p>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<table border="0" summary="Warning">
<tr>
<td rowspan="2" align="center" valign="top">
<img alt="[Warning]" src="images/warning.png"/>
</td>
<th align="left">Warning</th>
</tr>
<tr>
<td align="left" valign="top">
<p>Configuration errors of PAM may lock you out of your own system. You must have a rescue CD handy or setup an alternative boot partition. To recover, boot the system with them and correct things from there.</p>
</td>
</tr>
</table>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title"><a id="_normal_unix_authentication"/>4.1. Normal Unix authentication</h2>
</div>
</div>
</div>
<p>Normal Unix authentication is provided by the <span class="citerefentry"><span class="refentrytitle">pam_unix</span>(8)</span> module under the <a class="ulink" href="http://en.wikipedia.org/wiki/Pluggable_Authentication_Modules">PAM (Pluggable Authentication Modules)</a>. Its 3 important configuration files, with "<code class="literal">:</code>" separated entries, are the following.</p>
<div class="table">
<a id="dimportantconfigilesforpam_unixi"/>
<p class="title">
<strong>Table 4.1. 3 important configuration files for <span class="citerefentry"><span class="refentrytitle">pam_unix</span>(8)</span></strong>
</p>
<div class="table-contents">
<table summary="3 important configuration files for pam_unix8" border="1">
<colgroup>
<col style="text-align: left"/>
<col style="text-align: left"/>
<col style="text-align: left"/>
<col style="text-align: left"/>
<col style="text-align: left"/>
</colgroup>
<thead>
<tr>
<th style="text-align: left">
file
</th>
<th style="text-align: left">
permission
</th>
<th style="text-align: left">
user
</th>
<th style="text-align: left">
group
</th>
<th style="text-align: left">
description
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left">
<code class="literal">/etc/passwd</code>
</td>
<td style="text-align: left">
<code class="literal">-rw-r--r--</code>
</td>
<td style="text-align: left">
<code class="literal">root</code>
</td>
<td style="text-align: left">
<code class="literal">root</code>
</td>
<td style="text-align: left">
(sanitized) user account information
</td>
</tr>
<tr>
<td style="text-align: left">
<code class="literal">/etc/shadow</code>
</td>
<td style="text-align: left">
<code class="literal">-rw-r-----</code>
</td>
<td style="text-align: left">
<code class="literal">root</code>
</td>
<td style="text-align: left">
<code class="literal">shadow</code>
</td>
<td style="text-align: left">
secure user account information
</td>
</tr>
<tr>
<td style="text-align: left">
<code class="literal">/etc/group</code>
</td>
<td style="text-align: left">
<code class="literal">-rw-r--r--</code>
</td>
<td style="text-align: left">
<code class="literal">root</code>
</td>
<td style="text-align: left">
<code class="literal">root</code>
</td>
<td style="text-align: left">
group information
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="table-break"/>
<p>"<code class="literal">/etc/passwd</code>" contains the following.</p>
<pre class="screen"> ...
user1:x:1000:1000:User1 Name,,,:/home/user1:/bin/bash
user2:x:1001:1001:User2 Name,,,:/home/user2:/bin/bash
...</pre>
<p>As explained in <span class="citerefentry"><span class="refentrytitle">passwd</span>(5)</span>, each "<code class="literal">:</code>" separated entry of this file means the following.</p>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p>
Login name
</p>
</li>
<li class="listitem">
<p>
Password specification entry
</p>
</li>
<li class="listitem">
<p>
Numerical user ID
</p>
</li>
<li class="listitem">
<p>
Numerical group ID
</p>
</li>
<li class="listitem">
<p>
User name or comment field
</p>
</li>
<li class="listitem">
<p>
User home directory
</p>
</li>
<li class="listitem">
<p>
Optional user command interpreter
</p>
</li>
</ul>
</div>
<p>The second entry of "<code class="literal">/etc/passwd</code>" was used for the encrypted password entry. After the introduction of "<code class="literal">/etc/shadow</code>", this entry is used for the password specification entry.</p>
<div class="table">
<a id="thesecondentrycontentofetcpasswd"/>
<p class="title">
<strong>Table 4.2. The second entry content of "<code class="literal">/etc/passwd</code>"</strong>
</p>
<div class="table-contents">
<table summary="The second entry content of "/etc/passwd"" border="1">
<colgroup>
<col style="text-align: left"/>
<col style="text-align: left"/>
</colgroup>
<thead>
<tr>
<th style="text-align: left">
content
</th>
<th style="text-align: left">
meaning
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left">
(empty)
</td>
<td style="text-align: left">
passwordless account
</td>
</tr>
<tr>
<td style="text-align: left">
x
</td>
<td style="text-align: left">
the encrypted password is in "<code class="literal">/etc/shadow</code>"
</td>
</tr>
<tr>
<td style="text-align: left">
*
</td>
<td style="text-align: left">
no login for this account
</td>
</tr>
<tr>
<td style="text-align: left">
!
</td>
<td style="text-align: left">
no login for this account
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="table-break"/>
<p>"<code class="literal">/etc/shadow</code>" contains the following.</p>
<pre class="screen"> ...
user1:$1$Xop0FYH9$IfxyQwBe9b8tiyIkt2P4F/:13262:0:99999:7:::
user2:$1$vXGZLVbS$ElyErNf/agUDsm1DehJMS/:13261:0:99999:7:::
...</pre>
<p>As explained in <span class="citerefentry"><span class="refentrytitle">shadow</span>(5)</span>, each "<code class="literal">:</code>" separated entry of this file means the following.</p>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p>
Login name
</p>
</li>
<li class="listitem">
<p>
Encrypted password (The initial "<code class="literal">$1$</code>" indicates use of the MD5 encryption. The "*" indicates no login.)
</p>
</li>
<li class="listitem">
<p>
Date of the last password change, expressed as the number of days since Jan 1, 1970
</p>
</li>
<li class="listitem">
<p>
Number of days the user will have to wait before she will be allowed to change her password again
</p>
</li>
<li class="listitem">
<p>
Number of days after which the user will have to change her password
</p>
</li>
<li class="listitem">
<p>
Number of days before a password is going to expire during which the user should be warned
</p>
</li>
<li class="listitem">
<p>
Number of days after a password has expired during which the password should still be accepted
</p>
</li>
<li class="listitem">
<p>
Date of expiration of the account, expressed as the number of days since Jan 1, 1970
</p>
</li>
<li class="listitem">
<p>
…
</p>
</li>
</ul>
</div>
<p>"<code class="literal">/etc/group</code>" contains the following.</p>
<pre class="screen">group1:x:20:user1,user2</pre>
<p>As explained in <span class="citerefentry"><span class="refentrytitle">group</span>(5)</span>, each "<code class="literal">:</code>" separated entry of this file means the following.</p>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p>
Group name
</p>
</li>
<li class="listitem">
<p>
Encrypted password (not really used)
</p>
</li>
<li class="listitem">
<p>
Numerical group ID
</p>
</li>
<li class="listitem">
<p>
"," separated list of user names
</p>
</li>
</ul>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top">
<img alt="[Note]" src="images/note.png"/>
</td>
<th align="left">Note</th>
</tr>
<tr>
<td align="left" valign="top">
<p>"<code class="literal">/etc/gshadow</code>" provides the similar function as "<code class="literal">/etc/shadow</code>" for "<code class="literal">/etc/group</code>" but is not really used.</p>
</td>
</tr>
</table>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top">
<img alt="[Note]" src="images/note.png"/>
</td>
<th align="left">Note</th>
</tr>
<tr>
<td align="left" valign="top">
<p>The actual group membership of a user may be dynamically added if "<code class="literal">auth optional pam_group.so</code>" line is added to "<code class="literal">/etc/pam.d/common-auth</code>" and set it in "<code class="literal">/etc/security/group.conf</code>". See <span class="citerefentry"><span class="refentrytitle">pam_group</span>(8)</span>.</p>
</td>
</tr>
</table>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top">
<img alt="[Note]" src="images/note.png"/>
</td>
<th align="left">Note</th>
</tr>
<tr>
<td align="left" valign="top">
<p>The <code class="literal">base-passwd</code> package contains an authoritative list of the user and the group: "<code class="literal">/usr/share/doc/base-passwd/users-and-groups.html</code>".</p>
</td>
</tr>
</table>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title"><a id="_managing_account_and_password_information"/>4.2. Managing account and password information</h2>
</div>
</div>
</div>
<p>Here are few notable commands to manage account information.</p>
<div class="table">
<a id="listofcommandstocountinformation"/>
<p class="title">
<strong>Table 4.3. List of commands to manage account information</strong>
</p>
<div class="table-contents">
<table summary="List of commands to manage account information" border="1">
<colgroup>
<col style="text-align: left"/>
<col style="text-align: left"/>
</colgroup>
<thead>
<tr>
<th style="text-align: left">
command
</th>
<th style="text-align: left">
function
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left">
<code class="literal">getent passwd <user_name></code>
</td>
<td style="text-align: left">
browse account information of "<code class="literal"><user_name></code>"
</td>
</tr>
<tr>
<td style="text-align: left">
<code class="literal">getent shadow <user_name></code>
</td>
<td style="text-align: left">
browse shadowed account information of "<code class="literal"><user_name></code>"
</td>
</tr>
<tr>
<td style="text-align: left">
<code class="literal">getent group <group_name></code>
</td>
<td style="text-align: left">
browse group information of "<code class="literal"><group_name></code>"
</td>
</tr>
<tr>
<td style="text-align: left">
<code class="literal">passwd</code>
</td>
<td style="text-align: left">
manage password for the account
</td>
</tr>
<tr>
<td style="text-align: left">
<code class="literal">passwd -e</code>
</td>
<td style="text-align: left">
set one-time password for the account activation
</td>
</tr>
<tr>
<td style="text-align: left">
<code class="literal">chage</code>
</td>
<td style="text-align: left">
manage password aging information
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="table-break"/>
<p>You may need to have the root privilege for some functions to work. See <span class="citerefentry"><span class="refentrytitle">crypt</span>(3)</span> for the password and data encryption.</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top">
<img alt="[Note]" src="images/note.png"/>
</td>
<th align="left">Note</th>
</tr>
<tr>
<td align="left" valign="top">
<p>On the system set up with PAM and NSS as the Debian <a class="ulink" href="http://alioth.debian.org">alioth</a> machine, the content of local "<code class="literal">/etc/passwd</code>", "<code class="literal">/etc/group</code>" and "<code class="literal">/etc/shadow</code>" may not be actively used by the system. Above commands are valid even under such environment.</p>
</td>
</tr>
</table>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title"><a id="_good_password"/>4.3. Good password</h2>
</div>
</div>
</div>
<p>When creating an account during your system installation or with the <span class="citerefentry"><span class="refentrytitle">passwd</span>(1)</span> command, you should choose a <a class="ulink" href="http://en.wikipedia.org/wiki/Password_strength">good password</a> which consists of at least 6 to 8 characters including one or more characters from each of the following sets according to <span class="citerefentry"><span class="refentrytitle">passwd</span>(1)</span>.</p>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p>
Lower case alphabetics
</p>
</li>
<li class="listitem">
<p>
Digits 0 through 9
</p>
</li>
<li class="listitem">
<p>
Punctuation marks
</p>
</li>
</ul>
</div>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<table border="0" summary="Warning">
<tr>
<td rowspan="2" align="center" valign="top">
<img alt="[Warning]" src="images/warning.png"/>
</td>
<th align="left">Warning</th>
</tr>
<tr>
<td align="left" valign="top">
<p>Do not choose guessable words for the password. Account name, social security number, phone number, address, birthday, name of your family members or pets, dictionary words, simple sequence of characters such as "12345" or "qwerty", … are all bad choice for the password.</p>
</td>
</tr>
</table>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title"><a id="_creating_encrypted_password"/>4.4. Creating encrypted password</h2>
</div>
</div>
</div>
<p>There are independent tools to <a class="ulink" href="http://en.wikipedia.org/wiki/Salt_(cryptography)">generate encrypted passwords with salt</a>.</p>
<div class="table">
<a id="listoftoolstogeneratepassword"/>
<p class="title">
<strong>Table 4.4. List of tools to generate password</strong>
</p>
<div class="table-contents">
<table summary="List of tools to generate password" border="1">
<colgroup>
<col style="text-align: left"/>
<col style="text-align: left"/>
<col style="text-align: left"/>
<col style="text-align: left"/>
<col style="text-align: left"/>
</colgroup>
<thead>
<tr>
<th style="text-align: left">
package
</th>
<th style="text-align: left">
popcon
</th>
<th style="text-align: left">
size
</th>
<th style="text-align: left">
command
</th>
<th style="text-align: left">
function
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/whois">
<code class="literal">whois</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=whois">V:82, I:918</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/w/whois.html">207</a>
</td>
<td style="text-align: left">
<code class="literal">mkpasswd</code>
</td>
<td style="text-align: left">
over-featured front end to the <span class="citerefentry"><span class="refentrytitle">crypt</span>(3)</span> library
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/openssl">
<code class="literal">openssl</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=openssl">V:762, I:983</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/o/openssl.html">1099</a>
</td>
<td style="text-align: left">
<code class="literal">openssl passwd</code>
</td>
<td style="text-align: left">
compute password hashes (OpenSSL). <span class="citerefentry"><span class="refentrytitle">passwd</span>(1ssl)</span>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="table-break"/>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title"><a id="_pam_and_nss"/>4.5. PAM and NSS</h2>
</div>
</div>
</div>
<p>Modern <a class="ulink" href="http://en.wikipedia.org/wiki/Unix-like">Unix-like</a> systems such as the Debian system provide <a class="ulink" href="http://en.wikipedia.org/wiki/Pluggable_Authentication_Modules">PAM (Pluggable Authentication Modules)</a> and <a class="ulink" href="http://en.wikipedia.org/wiki/Name_Service_Switch">NSS (Name Service Switch)</a> mechanism to the local system administrator to configure his system. The role of these can be summarizes as the following.</p>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p>
PAM offers a flexible authentication mechanism used by the application software thus involves password data exchange.
</p>
</li>
<li class="listitem">
<p>
NSS offers a flexible name service mechanism which is frequently used by the <a class="ulink" href="http://en.wikipedia.org/wiki/C_standard_library">C standard library</a> to obtain the user and group name for programs such as <span class="citerefentry"><span class="refentrytitle">ls</span>(1)</span> and <span class="citerefentry"><span class="refentrytitle">id</span>(1)</span>.
</p>
</li>
</ul>
</div>
<p>These PAM and NSS systems need to be configured consistently.</p>
<p>The notable packages of PAM and NSS systems are the following.</p>
<div class="table">
<a id="listofnotablepamandnsssystems"/>
<p class="title">
<strong>Table 4.5. List of notable PAM and NSS systems</strong>
</p>
<div class="table-contents">
<table summary="List of notable PAM and NSS systems" border="1">
<colgroup>
<col style="text-align: left"/>
<col style="text-align: left"/>
<col style="text-align: left"/>
<col style="text-align: left"/>
</colgroup>
<thead>
<tr>
<th style="text-align: left">
package
</th>
<th style="text-align: left">
popcon
</th>
<th style="text-align: left">
size
</th>
<th style="text-align: left">
description
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/libpam-modules">
<code class="literal">libpam-modules</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=libpam-modules">V:728, I:999</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/libp/libpam-modules.html">852</a>
</td>
<td style="text-align: left">
Pluggable Authentication Modules (basic service)
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/libpam-ldap">
<code class="literal">libpam-ldap</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=libpam-ldap">V:7, I:23</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/libp/libpam-ldap.html">265</a>
</td>
<td style="text-align: left">
Pluggable Authentication Module allowing LDAP interfaces
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/libpam-cracklib">
<code class="literal">libpam-cracklib</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=libpam-cracklib">V:5, I:25</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/libp/libpam-cracklib.html">148</a>
</td>
<td style="text-align: left">
Pluggable Authentication Module to enable cracklib support
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/libpam-doc">
<code class="literal">libpam-doc</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=libpam-doc">I:3</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/libp/libpam-doc.html">986</a>
</td>
<td style="text-align: left">
Pluggable Authentication Modules (documentation in html and text)
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/libc6">
<code class="literal">libc6</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=libc6">V:918, I:998</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/libc/libc6.html">10280</a>
</td>
<td style="text-align: left">
GNU C Library: Shared libraries which also provides "Name Service Switch" service
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/glibc-doc">
<code class="literal">glibc-doc</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=glibc-doc">I:19</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/g/glibc-doc.html">2258</a>
</td>
<td style="text-align: left">
GNU C Library: Manpages
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/glibc-doc-reference">
<code class="literal">glibc-doc-reference</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=glibc-doc-reference">I:7</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/g/glibc-doc-reference.html">11934</a>
</td>
<td style="text-align: left">
GNU C Library: Reference manual in info, pdf and html format (non-free)
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/libnss-mdns">
<code class="literal">libnss-mdns</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=libnss-mdns">I:587</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/libn/libnss-mdns.html">106</a>
</td>
<td style="text-align: left">
NSS module for Multicast DNS name resolution
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/libnss-ldap">
<code class="literal">libnss-ldap</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=libnss-ldap">I:22</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/libn/libnss-ldap.html">293</a>
</td>
<td style="text-align: left">
NSS module for using LDAP as a naming service
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/libnss-ldapd">
<code class="literal">libnss-ldapd</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=libnss-ldapd">I:17</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/libn/libnss-ldapd.html">131</a>
</td>
<td style="text-align: left">
NSS module for using LDAP as a naming service (new fork of <code class="literal">libnss-ldap</code>)
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="table-break"/>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p>
"The Linux-PAM System Administrators' Guide" in <code class="literal">libpam-doc</code> is essential for learning PAM configuration.
</p>
</li>
<li class="listitem">
<p>
"System Databases and Name Service Switch" section in <code class="literal">glibc-doc-reference</code> is essential for learning NSS configuration.
</p>
</li>
</ul>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top">
<img alt="[Note]" src="images/note.png"/>
</td>
<th align="left">Note</th>
</tr>
<tr>
<td align="left" valign="top">
<p>You can see more extensive and current list by "<code class="literal">aptitude search 'libpam-|libnss-'</code>" command. The acronym NSS may also mean "Network Security Service" which is different from "Name Service Switch".</p>
</td>
</tr>
</table>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top">
<img alt="[Note]" src="images/note.png"/>
</td>
<th align="left">Note</th>
</tr>
<tr>
<td align="left" valign="top">
<p>PAM is the most basic way to initialize environment variables for each program with the system wide default value.</p>
</td>
</tr>
</table>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_configuration_files_accessed_by_pam_and_nss"/>4.5.1. Configuration files accessed by PAM and NSS</h3>
</div>
</div>
</div>
<p>Here are a few notable configuration files accessed by PAM and NSS.</p>
<div class="table">
<a id="listofconfiguratessedbypamandnss"/>
<p class="title">
<strong>Table 4.6. List of configuration files accessed by PAM and NSS</strong>
</p>
<div class="table-contents">
<table summary="List of configuration files accessed by PAM and NSS" border="1">
<colgroup>
<col style="text-align: left"/>
<col style="text-align: left"/>
</colgroup>
<thead>
<tr>
<th style="text-align: left">
configuration file
</th>
<th style="text-align: left">
function
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left">
<code class="literal">/etc/pam.d/<program_name></code>
</td>
<td style="text-align: left">
set up PAM configuration for the "<code class="literal"><program_name></code>" program; see <span class="citerefentry"><span class="refentrytitle">pam</span>(7)</span> and <span class="citerefentry"><span class="refentrytitle">pam.d</span>(5)</span>
</td>
</tr>
<tr>
<td style="text-align: left">
<code class="literal">/etc/nsswitch.conf</code>
</td>
<td style="text-align: left">
set up NSS configuration with the entry for each service. See <span class="citerefentry"><span class="refentrytitle">nsswitch.conf</span>(5)</span>
</td>
</tr>
<tr>
<td style="text-align: left">
<code class="literal">/etc/nologin</code>
</td>
<td style="text-align: left">
limit the user login by the <span class="citerefentry"><span class="refentrytitle">pam_nologin</span>(8)</span> module
</td>
</tr>
<tr>
<td style="text-align: left">
<code class="literal">/etc/securetty</code>
</td>
<td style="text-align: left">
limit the tty for the root access by the <span class="citerefentry"><span class="refentrytitle">pam_securetty</span>(8)</span> module
</td>
</tr>
<tr>
<td style="text-align: left">
<code class="literal">/etc/security/access.conf</code>
</td>
<td style="text-align: left">
set access limit by the <span class="citerefentry"><span class="refentrytitle">pam_access</span>(8)</span> module
</td>
</tr>
<tr>
<td style="text-align: left">
<code class="literal">/etc/security/group.conf</code>
</td>
<td style="text-align: left">
set group based restraint by the <span class="citerefentry"><span class="refentrytitle">pam_group</span>(8)</span> module
</td>
</tr>
<tr>
<td style="text-align: left">
<code class="literal">/etc/security/pam_env.conf</code>
</td>
<td style="text-align: left">
set environment variables by the <span class="citerefentry"><span class="refentrytitle">pam_env</span>(8)</span> module
</td>
</tr>
<tr>
<td style="text-align: left">
<code class="literal">/etc/environment</code>
</td>
<td style="text-align: left">
set additional environment variables by the <span class="citerefentry"><span class="refentrytitle">pam_env</span>(8)</span> module with the "<code class="literal">readenv=1</code>" argument
</td>
</tr>
<tr>
<td style="text-align: left">
<code class="literal">/etc/default/locale</code>
</td>
<td style="text-align: left">
set locale by <span class="citerefentry"><span class="refentrytitle">pam_env</span>(8)</span> module with the "<code class="literal">readenv=1 envfile=/etc/default/locale</code>" argument (Debian)
</td>
</tr>
<tr>
<td style="text-align: left">
<code class="literal">/etc/security/limits.conf</code>
</td>
<td style="text-align: left">
set resource restraint (ulimit, core, …) by the <span class="citerefentry"><span class="refentrytitle">pam_linits</span>(8)</span> module
</td>
</tr>
<tr>
<td style="text-align: left">
<code class="literal">/etc/security/time.conf</code>
</td>
<td style="text-align: left">
set time restraint by the <span class="citerefentry"><span class="refentrytitle">pam_time</span>(8)</span> module
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="table-break"/>
<p>The limitation of the password selection is implemented by the PAM modules, <span class="citerefentry"><span class="refentrytitle">pam_unix</span>(8)</span> and <span class="citerefentry"><span class="refentrytitle">pam_cracklib</span>(8)</span>. They can be configured by their arguments.</p>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;">
<table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top">
<img alt="[Tip]" src="images/tip.png"/>
</td>
<th align="left">Tip</th>
</tr>
<tr>
<td align="left" valign="top">
<p>PAM modules use suffix "<code class="literal">.so</code>" for their filenames.</p>
</td>
</tr>
</table>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_the_modern_centralized_system_management"/>4.5.2. The modern centralized system management</h3>
</div>
</div>
</div>
<p>The modern centralized system management can be deployed using the centralized <a class="ulink" href="http://en.wikipedia.org/wiki/Lightweight_Directory_Access_Protocol">Lightweight Directory Access Protocol (LDAP)</a> server to administer many Unix-like and non-Unix-like systems on the network. The open source implementation of the Lightweight Directory Access Protocol is <a class="ulink" href="http://www.openldap.org/">OpenLDAP Software</a>.</p>
<p>The LDAP server provides the account information through the use of PAM and NSS with <code class="literal">libpam-ldap</code> and <code class="literal">libnss-ldap</code> packages for the Debian system. Several actions are required to enable this (I have not used this setup and the following is purely secondary information. Please read this in this context.).</p>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p>
You set up a centralized LDAP server by running a program such as the stand-alone LDAP daemon, <span class="citerefentry"><span class="refentrytitle">slapd</span>(8)</span>.
</p>
</li>
<li class="listitem">
<p>
You change the PAM configuration files in the "<code class="literal">/etc/pam.d/</code>" directory to use "<code class="literal">pam_ldap.so</code>" instead of the default "<code class="literal">pam_unix.so</code>".
</p>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p>
Debian uses "<code class="literal">/etc/pam_ldap.conf</code>" as the configuration file for <code class="literal">libpam-ldap</code> and "<code class="literal">/etc/pam_ldap.secret</code>" as the file to store the password of the root.
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
You change the NSS configuration in the "<code class="literal">/etc/nsswitch.conf</code>" file to use "<code class="literal">ldap</code>" instead of the default ("<code class="literal">compat</code>" or "<code class="literal">file</code>").
</p>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p>
Debian uses "<code class="literal">/etc/libnss-ldap.conf</code>" as the configuration file for <code class="literal">libnss-ldap</code>.
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
You must make <code class="literal">libpam-ldap</code> to use <a class="ulink" href="http://en.wikipedia.org/wiki/Transport_Layer_Security">SSL (or TLS)</a> connection for the security of password.
</p>
</li>
<li class="listitem">
<p>
You may make <code class="literal">libnss-ldap</code> to use <a class="ulink" href="http://en.wikipedia.org/wiki/Transport_Layer_Security">SSL (or TLS)</a> connection to ensure integrity of data at the cost of the LDAP network overhead.
</p>
</li>
<li class="listitem">
<p>
You should run <span class="citerefentry"><span class="refentrytitle">nscd</span>(8)</span> locally to cache any LDAP search results in order to reduce the LDAP network traffic.
</p>
</li>
</ul>
</div>
<p>See documentations in <span class="citerefentry"><span class="refentrytitle">pam_ldap.conf</span>(5)</span> and "<code class="literal">/usr/share/doc/libpam-doc/html/</code>" offered by the <code class="literal">libpam-doc</code> package and "<code class="literal">info libc 'Name Service Switch'</code>" offered by the <code class="literal">glibc-doc</code> package.</p>
<p>Similarly, you can set up alternative centralized systems with other methods.</p>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p>
Integration of user and group with the Windows system.
</p>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p>
Access <a class="ulink" href="http://en.wikipedia.org/wiki/Windows_domain">Windows domain</a> services by the <code class="literal">winbind</code> and <code class="literal">libpam_winbind</code> packages.
</p>
</li>
<li class="listitem">
<p>
See <span class="citerefentry"><span class="refentrytitle">winbindd</span>(8)</span> and <a class="ulink" href="http://www.samba.org/samba/docs/man/Samba-HOWTO-Collection/integrate-ms-networks.html">Integrating MS Windows Networks with Samba</a>.
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p>
Integration of user and group with the legacy Unix-like system.
</p>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p>
Access <a class="ulink" href="http://en.wikipedia.org/wiki/Network_Information_Service">NIS (originally called YP)</a> or <a class="ulink" href="http://en.wikipedia.org/wiki/NIS+">NIS+</a> by the <code class="literal">nis</code> package.
</p>
</li>
<li class="listitem">
<p>
See <a class="ulink" href="http://tldp.org/HOWTO/NIS-HOWTO/">The Linux NIS(YP)/NYS/NIS+ HOWTO</a>.
</p>
</li>
</ul>
</div>
</li>
</ul>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_why_gnu_su_does_not_support_the_wheel_group"/>4.5.3. "Why GNU su does not support the wheel group"</h3>
</div>
</div>
</div>
<p>This is the famous phrase at the bottom of the old "<code class="literal">info su</code>" page by Richard M. Stallman. Not to worry: the current <code class="literal">su</code> command in Debian uses PAM, so that one can restrict the ability to use <code class="literal">su</code> to the <code class="literal">root</code> group by enabling the line with "<code class="literal">pam_wheel.so</code>" in "<code class="literal">/etc/pam.d/su</code>".</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_stricter_password_rule"/>4.5.4. Stricter password rule</h3>
</div>
</div>
</div>
<p>Installing the <code class="literal">libpam-cracklib</code> package enables you to force stricter password rule, for example, by having active lines in "<code class="literal">/etc/pam.d/common-password</code>" as the following.</p>
<p>For <code class="literal">squeeze</code>:</p>
<pre class="screen">password required pam_cracklib.so retry=3 minlen=9 difok=3
password [success=1 default=ignore] pam_unix.so use_authtok nullok md5
password requisite pam_deny.so
password required pam_permit.so</pre>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title"><a id="_other_access_controls"/>4.6. Other access controls</h2>
</div>
</div>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top">
<img alt="[Note]" src="images/note.png"/>
</td>
<th align="left">Note</th>
</tr>
<tr>
<td align="left" valign="top">
<p>See <a class="xref" href="ch09.en.html#_alt_sysrq_key" title="9.3.15. Alt-SysRq key">Section 9.3.15, “Alt-SysRq key”</a> for restricting the kernel <a class="ulink" href="http://en.wikipedia.org/wiki/Secure_attention_key">secure attention key (SAK)</a> feature.</p>
</td>
</tr>
</table>
</div>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;">
<table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top">
<img alt="[Tip]" src="images/tip.png"/>
</td>
<th align="left">Tip</th>
</tr>
<tr>
<td align="left" valign="top">
<p>Under <a class="ulink" href="http://en.wikipedia.org/wiki/Systemd">systemd</a>, <a class="ulink" href="http://en.wikipedia.org/wiki/Systemd#logind">logind</a> may be used to manage user logins. See <span class="citerefentry"><span class="refentrytitle">systemd-logind</span>(8)</span>.</p>
</td>
</tr>
</table>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_sudo"/>4.6.1. sudo</h3>
</div>
</div>
</div>
<p><span class="citerefentry"><span class="refentrytitle">sudo</span>(8)</span> is a program designed to allow a sysadmin to give limited root privileges to users and log root activity. <code class="literal">sudo</code> requires only an ordinary user's password. Install <code class="literal">sudo</code> package and activate it by setting options in "<code class="literal">/etc/sudoers</code>". See configuration example at "<code class="literal">/usr/share/doc/sudo/examples/sudoers</code>" and <a class="xref" href="ch01.en.html#_sudo_configuration" title="1.1.12. sudo configuration">Section 1.1.12, “sudo configuration”</a>.</p>
<p>My usage of <code class="literal">sudo</code> for the single user system (see <a class="xref" href="ch01.en.html#_sudo_configuration" title="1.1.12. sudo configuration">Section 1.1.12, “sudo configuration”</a>) is aimed to protect myself from my own stupidity. Personally, I consider using <code class="literal">sudo</code> a better alternative than using the system from the root account all the time. For example, the following changes the owner of "<code class="literal"><some_file></code>" to "<code class="literal"><my_name></code>".</p>
<pre class="screen">$ sudo chown <my_name> <some_file></pre>
<p>Of course if you know the root password (as self-installed Debian users do), any command can be run under root from any user's account using "<code class="literal">su -c</code>".</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_policykit"/>4.6.2. PolicyKit</h3>
</div>
</div>
</div>
<p><a class="ulink" href="http://en.wikipedia.org/wiki/PolicyKit">PolicyKit</a> is an operating system component for controlling system-wide privileges in Unix-like operating systems.</p>
<p>Newer GUI applications are not designed to run as privileged processes. They talk to privileged processes via PolicyKit to perform administrative operations.</p>
<p>PolicyKit limits such operations to user accounts belonging to the <code class="literal">sudo</code> group on the Debian system.</p>
<p>See <span class="citerefentry"><span class="refentrytitle">polkit</span>(8)</span>.</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_selinux"/>4.6.3. SELinux</h3>
</div>
</div>
</div>
<p><a class="ulink" href="http://en.wikipedia.org/wiki/Security-Enhanced_Linux">Security-Enhanced Linux (SELinux)</a> is a framework to tighten privilege model tighter than the ordinary Unix-like security model with the <a class="ulink" href="http://en.wikipedia.org/wiki/Mandatory_access_control">mandatory access control (MAC)</a> policies. The root power may be restricted under some conditions.</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_restricting_access_to_some_server_services"/>4.6.4. Restricting access to some server services</h3>
</div>
</div>
</div>
<p>For system security, it is a good idea to disable as much server programs as possible. This becomes critical for network servers. Having unused servers, activated either directly as <a class="ulink" href="http://en.wikipedia.org/wiki/Daemon_(computer_software)">daemon</a> or via <a class="ulink" href="http://en.wikipedia.org/wiki/Super-server">super-server</a> program, are considered security risks.</p>
<p>Many programs, such as <span class="citerefentry"><span class="refentrytitle">sshd</span>(8)</span>, use PAM based access control. There are many ways to restrict access to some server services.</p>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p>
configuration files: "<code class="literal">/etc/default/<program_name></code>"
</p>
</li>
<li class="listitem">
<p>
runlevel configuration for <a class="ulink" href="http://en.wikipedia.org/wiki/Daemon_(computer_software)">daemon</a>
</p>
</li>
<li class="listitem">
<p>
<a class="ulink" href="http://en.wikipedia.org/wiki/Pluggable_Authentication_Modules">PAM (Pluggable Authentication Modules)</a>
</p>
</li>
<li class="listitem">
<p>
"<code class="literal">/etc/inetd.conf</code>" for <a class="ulink" href="http://en.wikipedia.org/wiki/Super-server">super-server</a>
</p>
</li>
<li class="listitem">
<p>
"<code class="literal">/etc/hosts.deny</code>" and "<code class="literal">/etc/hosts.allow</code>" for <a class="ulink" href="http://en.wikipedia.org/wiki/TCP_Wrapper">TCP wrapper</a>, <span class="citerefentry"><span class="refentrytitle">tcpd</span>(8)</span>
</p>
</li>
<li class="listitem">
<p>
"<code class="literal">/etc/rpc.conf</code>" for <a class="ulink" href="http://en.wikipedia.org/wiki/Open_Network_Computing_Remote_Procedure_Call">Sun RPC</a>
</p>
</li>
<li class="listitem">
<p>
"<code class="literal">/etc/at.allow</code>" and "<code class="literal">/etc/at.deny</code>" for <span class="citerefentry"><span class="refentrytitle">atd</span>(8)</span>
</p>
</li>
<li class="listitem">
<p>
"<code class="literal">/etc/cron.allow</code>" and "<code class="literal">/etc/cron.deny</code>" for <span class="citerefentry"><span class="refentrytitle">crontab</span>(1)</span>
</p>
</li>
<li class="listitem">
<p><a class="ulink" href="http://en.wikipedia.org/wiki/Firewall">Network firewall</a> of <a class="ulink" href="http://en.wikipedia.org/wiki/Netfilter">netfilter</a> infrastructure
</p>
</li>
</ul>
</div>
<p>See <a class="xref" href="ch03.en.html#_the_runlevel_management_example" title="3.2.3. The runlevel management example">Section 3.2.3, “The runlevel management example”</a>, <a class="xref" href="ch03.en.html#_the_default_parameter_for_each_init_script" title="3.2.4. The default parameter for each init script">Section 3.2.4, “The default parameter for each init script”</a>, <a class="xref" href="ch04.en.html#_configuration_files_accessed_by_pam_and_nss" title="4.5.1. Configuration files accessed by PAM and NSS">Section 4.5.1, “Configuration files accessed by PAM and NSS”</a>, <a class="xref" href="ch03.en.html#_network_service_initialization" title="3.2.8. Network service initialization">Section 3.2.8, “Network service initialization”</a>, and <a class="xref" href="ch05.en.html#_netfilter_infrastructure" title="5.9. Netfilter infrastructure">Section 5.9, “Netfilter infrastructure”</a>.</p>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;">
<table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top">
<img alt="[Tip]" src="images/tip.png"/>
</td>
<th align="left">Tip</th>
</tr>
<tr>
<td align="left" valign="top">
<p><a class="ulink" href="http://en.wikipedia.org/wiki/Open_Network_Computing_Remote_Procedure_Call">Sun RPC</a> services need to be active for <a class="ulink" href="http://en.wikipedia.org/wiki/Network_File_System_(protocol)">NFS</a> and other RPC based programs.</p>
</td>
</tr>
</table>
</div>
<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;">
<table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top">
<img alt="[Tip]" src="images/tip.png"/>
</td>
<th align="left">Tip</th>
</tr>
<tr>
<td align="left" valign="top">
<p>If you have problems with remote access in a recent Debian system, comment out offending configuration such as "ALL: PARANOID" in "<code class="literal">/etc/hosts.deny</code>" if it exists. (But you must be careful on security risks involved with this kind of action.)</p>
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h2 class="title"><a id="_security_of_authentication"/>4.7. Security of authentication</h2>
</div>
</div>
</div>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top">
<img alt="[Note]" src="images/note.png"/>
</td>
<th align="left">Note</th>
</tr>
<tr>
<td align="left" valign="top">
<p>The information here <span class="strong"><strong>may not be sufficient</strong></span> for your security needs but it should be a <span class="strong"><strong>good start</strong></span>.</p>
</td>
</tr>
</table>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_secure_password_on_the_internet"/>4.7.1. Secure password on the Internet</h3>
</div>
</div>
</div>
<p>Many popular transportation layer services communicate messages including password authentication in the plain text. It is very bad idea to transmit password in the plain text over the wild Internet where it can be intercepted. You can run these services over "<a class="ulink" href="http://en.wikipedia.org/wiki/Transport_Layer_Security">Transport Layer Security</a>" (TLS) or its predecessor, "Secure Sockets Layer" (SSL) to secure entire communication including password by the encryption.</p>
<div class="table">
<a id="listofinsecureanservicesandports"/>
<p class="title">
<strong>Table 4.7. List of insecure and secure services and ports</strong>
</p>
<div class="table-contents">
<table summary="List of insecure and secure services and ports" border="1">
<colgroup>
<col style="text-align: left"/>
<col style="text-align: left"/>
<col style="text-align: left"/>
<col style="text-align: left"/>
</colgroup>
<thead>
<tr>
<th style="text-align: left">
insecure service name
</th>
<th style="text-align: left">
port
</th>
<th style="text-align: left">
secure service name
</th>
<th style="text-align: left">
port
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left">
www (http)
</td>
<td style="text-align: left">
80
</td>
<td style="text-align: left">
https
</td>
<td style="text-align: left">
443
</td>
</tr>
<tr>
<td style="text-align: left">
smtp (mail)
</td>
<td style="text-align: left">
25
</td>
<td style="text-align: left">
ssmtp (smtps)
</td>
<td style="text-align: left">
465
</td>
</tr>
<tr>
<td style="text-align: left">
ftp-data
</td>
<td style="text-align: left">
20
</td>
<td style="text-align: left">
ftps-data
</td>
<td style="text-align: left">
989
</td>
</tr>
<tr>
<td style="text-align: left">
ftp
</td>
<td style="text-align: left">
21
</td>
<td style="text-align: left">
ftps
</td>
<td style="text-align: left">
990
</td>
</tr>
<tr>
<td style="text-align: left">
telnet
</td>
<td style="text-align: left">
23
</td>
<td style="text-align: left">
telnets
</td>
<td style="text-align: left">
992
</td>
</tr>
<tr>
<td style="text-align: left">
imap2
</td>
<td style="text-align: left">
143
</td>
<td style="text-align: left">
imaps
</td>
<td style="text-align: left">
993
</td>
</tr>
<tr>
<td style="text-align: left">
pop3
</td>
<td style="text-align: left">
110
</td>
<td style="text-align: left">
pop3s
</td>
<td style="text-align: left">
995
</td>
</tr>
<tr>
<td style="text-align: left">
ldap
</td>
<td style="text-align: left">
389
</td>
<td style="text-align: left">
ldaps
</td>
<td style="text-align: left">
636
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="table-break"/>
<p>The encryption costs CPU time. As a CPU friendly alternative, you can keep communication in plain text while securing just the password with the secure authentication protocol such as "Authenticated Post Office Protocol" (APOP) for POP and "Challenge-Response Authentication Mechanism MD5" (CRAM-MD5) for SMTP and IMAP. (For sending mail messages over the Internet to your mail server from your mail client, it is recently popular to use new message submission port 587 instead of traditional SMTP port 25 to avoid port 25 blocking by the network provider while authenticating yourself with CRAM-MD5.)</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_secure_shell"/>4.7.2. Secure Shell</h3>
</div>
</div>
</div>
<p>The <a class="ulink" href="http://en.wikipedia.org/wiki/Secure_Shell">Secure Shell (SSH)</a> program provides secure encrypted communications between two untrusted hosts over an insecure network with the secure authentication. It consists of the <a class="ulink" href="http://www.openssh.org/">OpenSSH</a> client, <span class="citerefentry"><span class="refentrytitle">ssh</span>(1)</span>, and the <a class="ulink" href="http://www.openssh.org/">OpenSSH</a> daemon, <span class="citerefentry"><span class="refentrytitle">sshd</span>(8)</span>. This SSH can be used to tunnel an insecure protocol communication such as POP and X securely over the Internet with the port forwarding feature.</p>
<p>The client tries to authenticate itself using host-based authentication, public key authentication, challenge-response authentication, or password authentication. The use of public key authentication enables the remote password-less login. See <a class="xref" href="ch06.en.html#_the_remote_access_server_and_utilities_ssh" title="6.9. The remote access server and utilities (SSH)">Section 6.9, “The remote access server and utilities (SSH)”</a>.</p>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_extra_security_measures_for_the_internet"/>4.7.3. Extra security measures for the Internet</h3>
</div>
</div>
</div>
<p>Even when you run secure services such as <a class="ulink" href="http://en.wikipedia.org/wiki/Secure_Shell">Secure Shell (SSH)</a> and <a class="ulink" href="http://en.wikipedia.org/wiki/Point-to-point_tunneling_protocol">Point-to-point tunneling protocol (PPTP)</a> servers, there are still chances for the break-ins using brute force password guessing attack etc. from the Internet. Use of the firewall policy (see <a class="xref" href="ch05.en.html#_netfilter_infrastructure" title="5.9. Netfilter infrastructure">Section 5.9, “Netfilter infrastructure”</a>) together with the following secure tools may improve the security situation.</p>
<div class="table">
<a id="listoftoolstoprosecuritymeasures"/>
<p class="title">
<strong>Table 4.8. List of tools to provide extra security measures</strong>
</p>
<div class="table-contents">
<table summary="List of tools to provide extra security measures" border="1">
<colgroup>
<col style="text-align: left"/>
<col style="text-align: left"/>
<col style="text-align: left"/>
<col style="text-align: left"/>
</colgroup>
<thead>
<tr>
<th style="text-align: left">
package
</th>
<th style="text-align: left">
popcon
</th>
<th style="text-align: left">
size
</th>
<th style="text-align: left">
description
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/knockd">
<code class="literal">knockd</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=knockd">V:0, I:2</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/k/knockd.html">164</a>
</td>
<td style="text-align: left">
small port-knock daemon <span class="citerefentry"><span class="refentrytitle">knockd</span>(1)</span> and client <span class="citerefentry"><span class="refentrytitle">konck</span>(1)</span>
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/fail2ban">
<code class="literal">fail2ban</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=fail2ban">V:72, I:82</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/f/fail2ban.html">563</a>
</td>
<td style="text-align: left">
ban IPs that cause multiple authentication errors
</td>
</tr>
<tr>
<td style="text-align: left">
<a class="ulink" href="http://packages.debian.org/sid/libpam-shield">
<code class="literal">libpam-shield</code>
</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://qa.debian.org/popcon.php?package=libpam-shield">V:0, I:0</a>
</td>
<td style="text-align: left">
<a class="ulink" href="http://packages.qa.debian.org/libp/libpam-shield.html">154</a>
</td>
<td style="text-align: left">
lock out remote attackers trying password guessing
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br class="table-break"/>
</div>
<div class="section">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="_securing_the_root_password"/>4.7.4. Securing the root password</h3>
</div>
</div>
</div>
<p>To prevent people to access your machine with root privilege, you need to make following actions.</p>
<div class="itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<p>
Prevent physical access to the hard disk
</p>
</li>
<li class="listitem">
<p>
Lock BIOS and prevent booting from the removable media
</p>
</li>
<li class="listitem">
<p>
Set password for GRUB interactive session
</p>
</li>
<li class="listitem">
<p>
Lock GRUB menu from editing
</p>
</li>
</ul>
</div>
<p>With physical access to hard disk, resetting the password is relatively easy with following steps.</p>
<div class="orderedlist">
<ol class="orderedlist">
<li class="listitem">
<p>
Move the hard disk to a PC with CD bootable BIOS.
</p>
</li>
<li class="listitem">
<p>
Boot system with a rescue media (Debian boot disk, Knoppix CD, GRUB CD, …).
</p>
</li>
<li class="listitem">
<p>
Mount root partition with read/write access.
</p>
</li>
<li class="listitem">
<p>
Edit "<code class="literal">/etc/passwd</code>" in the root partition and make the second entry for the <code class="literal">root</code> account empty.
</p>
</li>
</ol>
</div>
<p>If you have edit access to the GRUB menu entry (see <a class="xref" href="ch03.en.html#_stage_2_the_boot_loader" title="3.1.2. Stage 2: the boot loader">Section 3.1.2, “Stage 2: the boot loader”</a>) for <code class="literal">grub-rescue-pc</code> at boot time, it is even easier with following steps.</p>
<div class="orderedlist">
<ol class="orderedlist">
<li class="listitem">
<p>
Boot system with the kernel parameter changed to something like "<code class="literal">root=/dev/hda6 rw init=/bin/sh</code>".
</p>
</li>
<li class="listitem">
<p>
Edit "<code class="literal">/etc/passwd</code>" and make the second entry for the <code class="literal">root</code> account empty.
</p>
</li>
<li class="listitem">
<p>
Reboot system.
</p>
</li>
</ol>
</div>
<p>The root shell of the system is now accessible without password.</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top">
<img alt="[Note]" src="images/note.png"/>
</td>
<th align="left">Note</th>
</tr>
<tr>
<td align="left" valign="top">
<p>Once one has root shell access, he can access everything on the system and reset any passwords on the system. Further more, he may compromise password for all user accounts using brute force password cracking tools such as <code class="literal">john</code> and <code class="literal">crack</code> packages (see <a class="xref" href="ch09.en.html#_system_security_and_integrity_check" title="9.4.11. System security and integrity check">Section 9.4.11, “System security and integrity check”</a>). This cracked password may lead to compromise other systems.</p>
</td>
</tr>
</table>
</div>
<p>The only reasonable software solution to avoid all these concerns is to use software encrypted root partition (or "<code class="literal">/etc</code>" partition) using <a class="ulink" href="http://en.wikipedia.org/wiki/Dm-crypt">dm-crypt</a> and initramfs (see <a class="xref" href="ch09.en.html#_data_encryption_tips" title="9.8. Data encryption tips">Section 9.8, “Data encryption tips”</a>). You always need password to boot the system, though.</p>
</div>
</div>
</div>
<div class="navfooter">
<hr/>
<table width="100%" summary="Navigation footer">
<tr>
<td align="left"><a accesskey="p" href="ch03.en.html"><img src="images/prev.png" alt="Prev"/></a> </td>
<td align="center"> </td>
<td align="right"> <a accesskey="n" href="ch05.en.html"><img src="images/next.png" alt="Next"/></a></td>
</tr>
<tr>
<td align="left" valign="top">Chapter 3. The system initialization </td>
<td align="center">
<a accesskey="h" href="index.en.html">
<img src="images/home.png" alt="Home"/>
</a>
</td>
<td align="right" valign="top"> Chapter 5. Network setup</td>
</tr>
</table>
</div>
</body>
</html>
|