access.conf.5.xml 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. <?xml version="1.0" encoding='UTF-8'?>
  2. <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
  3. "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
  4. <refentry id="access.conf">
  5. <refmeta>
  6. <refentrytitle>access.conf</refentrytitle>
  7. <manvolnum>5</manvolnum>
  8. <refmiscinfo class="sectdesc">Linux-PAM Manual</refmiscinfo>
  9. </refmeta>
  10. <refnamediv>
  11. <refname>access.conf</refname>
  12. <refpurpose>the login access control table file</refpurpose>
  13. </refnamediv>
  14. <refsect1 id='access.conf-description'>
  15. <title>DESCRIPTION</title>
  16. <para>
  17. The <filename>/etc/security/access.conf</filename> file specifies
  18. (<replaceable>user/group</replaceable>, <replaceable>host</replaceable>),
  19. (<replaceable>user/group</replaceable>, <replaceable>network/netmask</replaceable>),
  20. (<replaceable>user/group</replaceable>, <replaceable>tty</replaceable>),
  21. (<replaceable>user/group</replaceable>,
  22. <replaceable>X-$DISPLAY-value</replaceable>), or
  23. (<replaceable>user/group</replaceable>,
  24. <replaceable>pam-service-name</replaceable>)
  25. combinations for which a login will be either accepted or refused.
  26. </para>
  27. <para>
  28. When someone logs in, the file <filename>access.conf</filename> is
  29. scanned for the first entry that matches the
  30. (<replaceable>user/group</replaceable>, <replaceable>host</replaceable>) or
  31. (<replaceable>user/group</replaceable>, <replaceable>network/netmask</replaceable>)
  32. combination, or, in case of non-networked logins, the first entry
  33. that matches the
  34. (<replaceable>user/group</replaceable>, <replaceable>tty</replaceable>)
  35. combination, or in the case of non-networked logins without a
  36. tty, the first entry that matches the
  37. (<replaceable>user/group</replaceable>,
  38. <replaceable>X-$DISPLAY-value</replaceable>) or
  39. (<replaceable>user/group</replaceable>,
  40. <replaceable>pam-service-name/</replaceable>)
  41. combination. The permissions field of that table entry
  42. determines
  43. whether the login will be accepted or refused.
  44. </para>
  45. <para>
  46. Each line of the login access control table has three fields separated
  47. by a ":" character (colon):
  48. </para>
  49. <para>
  50. <replaceable>permission</replaceable>:<replaceable>users/groups</replaceable>:<replaceable>origins</replaceable>
  51. </para>
  52. <para>
  53. The first field, the <replaceable>permission</replaceable> field, can be either a
  54. "<emphasis>+</emphasis>" character (plus) for access granted or a
  55. "<emphasis>-</emphasis>" character (minus) for access denied.
  56. </para>
  57. <para>
  58. The second field, the
  59. <replaceable>users</replaceable>/<replaceable>group</replaceable>
  60. field, should be a list of one or more login names, group names, or
  61. <emphasis>ALL</emphasis> (which always matches). To differentiate
  62. user entries from group entries, group entries should be written
  63. with brackets, e.g. <emphasis>(group)</emphasis>.
  64. </para>
  65. <para>
  66. The third field, the <replaceable>origins</replaceable>
  67. field, should be a list of one or more tty names (for non-networked
  68. logins), X <varname>$DISPLAY</varname> values or PAM service
  69. names (for non-networked logins without a tty), host names,
  70. domain names (begin with "."), host addresses,
  71. internet network numbers (end with "."), internet network addresses
  72. with network mask (where network mask can be a decimal number or an
  73. internet address also), <emphasis>ALL</emphasis> (which always matches)
  74. or <emphasis>LOCAL</emphasis>. The <emphasis>LOCAL</emphasis>
  75. keyword matches if and only if
  76. <citerefentry><refentrytitle>pam_get_item</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
  77. when called with an <parameter>item_type</parameter> of
  78. <emphasis>PAM_RHOST</emphasis>, returns <code>NULL</code> or an
  79. empty string (and therefore the
  80. <replaceable>origins</replaceable> field is compared against the
  81. return value of
  82. <citerefentry><refentrytitle>pam_get_item</refentrytitle><manvolnum>3</manvolnum></citerefentry>
  83. called with an <parameter>item_type</parameter> of
  84. <emphasis>PAM_TTY</emphasis> or, absent that,
  85. <emphasis>PAM_SERVICE</emphasis>).
  86. </para>
  87. <para>
  88. If supported by the system you can use
  89. <emphasis>@netgroupname</emphasis> in host or user patterns. The
  90. <emphasis>@@netgroupname</emphasis> syntax is supported in the user
  91. pattern only and it makes the local system hostname to be passed
  92. to the netgroup match call in addition to the user name. This might not
  93. work correctly on some libc implementations causing the match to
  94. always fail.
  95. </para>
  96. <para>
  97. The <replaceable>EXCEPT</replaceable> operator makes it possible to
  98. write very compact rules.
  99. </para>
  100. <para>
  101. If the <option>nodefgroup</option> is not set, the group file
  102. is searched when a name does not match that of the logged-in
  103. user. Only groups are matched in which users are explicitly listed.
  104. However the PAM module does not look at the primary group id of a user.
  105. </para>
  106. <para>
  107. The "<emphasis>#</emphasis>" character at start of line (no space
  108. at front) can be used to mark this line as a comment line.
  109. </para>
  110. </refsect1>
  111. <refsect1 id="access.conf-examples">
  112. <title>EXAMPLES</title>
  113. <para>
  114. These are some example lines which might be specified in
  115. <filename>/etc/security/access.conf</filename>.
  116. </para>
  117. <para>
  118. User <emphasis>root</emphasis> should be allowed to get access via
  119. <emphasis>cron</emphasis>, X11 terminal <emphasis remap='I'>:0</emphasis>,
  120. <emphasis>tty1</emphasis>, ..., <emphasis>tty5</emphasis>,
  121. <emphasis>tty6</emphasis>.
  122. </para>
  123. <para>+:root:crond :0 tty1 tty2 tty3 tty4 tty5 tty6</para>
  124. <para>
  125. User <emphasis>root</emphasis> should be allowed to get access from
  126. hosts which own the IPv4 addresses. This does not mean that the
  127. connection have to be a IPv4 one, a IPv6 connection from a host with
  128. one of this IPv4 addresses does work, too.
  129. </para>
  130. <para>+:root:192.168.200.1 192.168.200.4 192.168.200.9</para>
  131. <para>+:root:127.0.0.1</para>
  132. <para>
  133. User <emphasis>root</emphasis> should get access from network
  134. <literal>192.168.201.</literal> where the term will be evaluated by
  135. string matching. But it might be better to use network/netmask instead.
  136. The same meaning of <literal>192.168.201.</literal> is
  137. <emphasis>192.168.201.0/24</emphasis> or
  138. <emphasis>192.168.201.0/255.255.255.0</emphasis>.
  139. </para>
  140. <para>+:root:192.168.201.</para>
  141. <para>
  142. User <emphasis>root</emphasis> should be able to have access from hosts
  143. <emphasis>foo1.bar.org</emphasis> and <emphasis>foo2.bar.org</emphasis>
  144. (uses string matching also).
  145. </para>
  146. <para>+:root:foo1.bar.org foo2.bar.org</para>
  147. <para>
  148. User <emphasis>root</emphasis> should be able to have access from
  149. domain <emphasis>foo.bar.org</emphasis> (uses string matching also).
  150. </para>
  151. <para>+:root:.foo.bar.org</para>
  152. <para>
  153. User <emphasis>root</emphasis> should be denied to get access
  154. from all other sources.
  155. </para>
  156. <para>-:root:ALL</para>
  157. <para>
  158. User <emphasis>foo</emphasis> and members of netgroup
  159. <emphasis>admins</emphasis> should be allowed to get access
  160. from all sources. This will only work if netgroup service is available.
  161. </para>
  162. <para>+:@admins foo:ALL</para>
  163. <para>
  164. User <emphasis>john</emphasis> and <emphasis>foo</emphasis>
  165. should get access from IPv6 host address.
  166. </para>
  167. <para>+:john foo:2001:db8:0:101::1</para>
  168. <para>
  169. User <emphasis>john</emphasis> should get access from IPv6 net/mask.
  170. </para>
  171. <para>+:john:2001:db8:0:101::/64</para>
  172. <para>
  173. Members of group <emphasis>wheel</emphasis> should be allowed to get access
  174. from all sources.
  175. </para>
  176. <para>+:(wheel):ALL</para>
  177. <para>
  178. Disallow console logins to all but the shutdown, sync and all
  179. other accounts, which are a member of the wheel group.
  180. </para>
  181. <para>-:ALL EXCEPT (wheel) shutdown sync:LOCAL</para>
  182. <para>
  183. All other users should be denied to get access from all sources.
  184. </para>
  185. <para>-:ALL:ALL</para>
  186. </refsect1>
  187. <refsect1 id="access.conf-notes">
  188. <title>NOTES</title>
  189. <para>
  190. The default separators of list items in a field are space, ',', and tabulator
  191. characters. Thus conveniently if spaces are put at the beginning and the end of
  192. the fields they are ignored. However if the list separator is changed with the
  193. <emphasis>listsep</emphasis> option, the spaces will become part of the actual
  194. item and the line will be most probably ignored. For this reason, it is not
  195. recommended to put spaces around the ':' characters.
  196. </para>
  197. </refsect1>
  198. <refsect1 id="access.conf-see_also">
  199. <title>SEE ALSO</title>
  200. <para>
  201. <citerefentry><refentrytitle>pam_access</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
  202. <citerefentry><refentrytitle>pam.d</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
  203. <citerefentry><refentrytitle>pam</refentrytitle><manvolnum>8</manvolnum></citerefentry>
  204. </para>
  205. </refsect1>
  206. <refsect1 id="access.conf-author">
  207. <title>AUTHORS</title>
  208. <para>
  209. Original <citerefentry><refentrytitle>login.access</refentrytitle><manvolnum>5</manvolnum></citerefentry>
  210. manual was provided by Guido van Rooij which was renamed to
  211. <citerefentry><refentrytitle>access.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>
  212. to reflect relation to default config file.
  213. </para>
  214. <para>
  215. Network address / netmask description and example text was
  216. introduced by Mike Becher &lt;mike.becher@lrz-muenchen.de&gt;.
  217. </para>
  218. </refsect1>
  219. </refentry>