{"id":3431,"date":"2022-12-20T17:02:40","date_gmt":"2022-12-20T20:02:40","guid":{"rendered":"http:\/\/lode.uno\/linux-man\/index.php\/2022\/12\/20\/pam_listfile-man8\/"},"modified":"2022-12-20T17:02:40","modified_gmt":"2022-12-20T20:02:40","slug":"pam_listfile-man8","status":"publish","type":"post","link":"https:\/\/lode.uno\/linux-man\/2022\/12\/20\/pam_listfile-man8\/","title":{"rendered":"PAM_LISTFILE (man8)"},"content":{"rendered":"<h1 align=\"center\">PAM_LISTFILE<\/h1>\n<p> <a href=\"#NAME\">NAME<\/a><br \/> <a href=\"#SYNOPSIS\">SYNOPSIS<\/a><br \/> <a href=\"#DESCRIPTION\">DESCRIPTION<\/a><br \/> <a href=\"#OPTIONS\">OPTIONS<\/a><br \/> <a href=\"#MODULE TYPES PROVIDED\">MODULE TYPES PROVIDED<\/a><br \/> <a href=\"#RETURN VALUES\">RETURN VALUES<\/a><br \/> <a href=\"#EXAMPLES\">EXAMPLES<\/a><br \/> <a href=\"#SEE ALSO\">SEE ALSO<\/a><br \/> <a href=\"#AUTHOR\">AUTHOR<\/a> <\/p>\n<hr>\n<h2>NAME <a name=\"NAME\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">pam_listfile \u2212 deny or allow services based on an arbitrary file<\/p>\n<h2>SYNOPSIS <a name=\"SYNOPSIS\"><\/a> <\/h2>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"89%\">\n<p style=\"margin-top: 1em\"><b>pam_listfile.so<\/b> item=[tty|user|rhost|ruser|group|shell] sense=[allow|deny] file=<i>\/path\/filename<\/i> onerr=[succeed|fail] [apply=[<i>user<\/i>|<i>@group<\/i>]] [quiet]<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<h2>DESCRIPTION <a name=\"DESCRIPTION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">pam_listfile is a PAM module which provides a way to deny or allow services based on an arbitrary file.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The module gets the <b>item<\/b> of the type specified \u2212\u2212 <i>user<\/i> specifies the username, <i>PAM_USER<\/i>; tty specifies the name of the terminal over which the request has been made, <i>PAM_TTY<\/i>; rhost specifies the name of the remote host (if any) from which the request was made, <i>PAM_RHOST<\/i>; and ruser specifies the name of the remote user (if available) who made the request, <i>PAM_RUSER<\/i> \u2212\u2212 and looks for an instance of that item in the <b>file=<\/b><i>filename<\/i>. filename contains one line per item listed. If the item is found, then if <b>sense=<\/b><i>allow<\/i>, <i>PAM_SUCCESS<\/i> is returned, causing the authorization request to succeed; else if <b>sense=<\/b><i>deny<\/i>, <i>PAM_AUTH_ERR<\/i> is returned, causing the authorization request to fail.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">If an error is encountered (for instance, if filename does not exist, or a poorly\u2212constructed argument is encountered), then if <i>onerr=succeed<\/i>, <i>PAM_SUCCESS<\/i> is returned, otherwise if <i>onerr=fail<\/i>, <i>PAM_AUTH_ERR<\/i> or <i>PAM_SERVICE_ERR<\/i> (as appropriate) will be returned.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">An additional argument, <b>apply=<\/b>, can be used to restrict the application of the above to a specific user (<b>apply=<\/b><i>username<\/i>) or a given group (<b>apply=<\/b><i>@groupname<\/i>). This added restriction is only meaningful when used with the <i>tty<\/i>, <i>rhost<\/i> and <i>shell<\/i> items.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Besides this last one, all arguments should be specified; do not count on any default behavior.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">No credentials are awarded by this module.<\/p>\n<h2>OPTIONS <a name=\"OPTIONS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>item=[tty|user|rhost|ruser|group|shell]<\/b><\/p>\n<p style=\"margin-left:17%;\">What is listed in the file and should be checked for.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>sense=[allow|deny]<\/b><\/p>\n<p style=\"margin-left:17%;\">Action to take if found in file, if the item is NOT found in the file, then the opposite action is requested.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>file=<\/b><i>\/path\/filename<\/i><\/p>\n<p style=\"margin-left:17%;\">File containing one item per line. The file needs to be a plain file and not world writable.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>onerr=[succeed|fail]<\/b><\/p>\n<p style=\"margin-left:17%;\">What to do if something weird happens like being unable to open the file.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>apply=[<\/b><i>user<\/i><b>|<\/b><i>@group<\/i><b>]<\/b><\/p>\n<p style=\"margin-left:17%;\">Restrict the user class for which the restriction apply. Note that with <b>item=[user|ruser|group]<\/b> this does not make sense, but for <b>item=[tty|rhost|shell]<\/b> it have a meaning.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>quiet<\/b><\/p>\n<p style=\"margin-left:17%;\">Do not treat service refusals or missing list files as errors that need to be logged.<\/p>\n<h2>MODULE TYPES PROVIDED <a name=\"MODULE TYPES PROVIDED\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">All module types (<b>auth<\/b>, <b>account<\/b>, <b>password<\/b> and <b>session<\/b>) are provided.<\/p>\n<h2>RETURN VALUES <a name=\"RETURN VALUES\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">PAM_AUTH_ERR<\/p>\n<p style=\"margin-left:17%;\">Authentication failure.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">PAM_BUF_ERR<\/p>\n<p style=\"margin-left:17%;\">Memory buffer error.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">PAM_IGNORE<\/p>\n<p style=\"margin-left:17%;\">The rule does not apply to the <b>apply<\/b> option.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">PAM_SERVICE_ERR<\/p>\n<p style=\"margin-left:17%;\">Error in service module.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">PAM_SUCCESS<\/p>\n<p style=\"margin-left:17%;\">Success.<\/p>\n<h2>EXAMPLES <a name=\"EXAMPLES\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Classic &#8216;ftpusers&#8217; authentication can be implemented with this entry in \/etc\/pam.d\/ftpd:<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"># <br \/> # deny ftp\u2212access to users listed in the \/etc\/ftpusers file <br \/> # <br \/> auth required pam_listfile.so  <br \/> onerr=succeed item=user sense=deny file=\/etc\/ftpusers<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Note, users listed in \/etc\/ftpusers file are (counterintuitively) <i>not<\/i> allowed access to the ftp service.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">To allow login access only for certain users, you can use a \/etc\/pam.d\/login entry like this:<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"># <br \/> # permit login to users listed in \/etc\/loginusers <br \/> # <br \/> auth required pam_listfile.so  <br \/> onerr=fail item=user sense=allow file=\/etc\/loginusers<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">For this example to work, all users who are allowed to use the login service should be listed in the file \/etc\/loginusers. Unless you are explicitly trying to lock out root, make sure that when you do this, you leave a way for root to log in, either by listing root in \/etc\/loginusers, or by listing a user who is able to <i>su<\/i> to the root account.<\/p>\n<h2>SEE ALSO <a name=\"SEE ALSO\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>pam.conf<\/b>(5), <b>pam.d<\/b>(5), <b>pam<\/b>(8)<\/p>\n<h2>AUTHOR <a name=\"AUTHOR\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">pam_listfile was written by Michael K. Johnson <johnsonm@redhat.com> and Elliot Lee <sopwith@cuc.edu>.<\/p>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>  pam_listfile \u2212 deny or allow services based on an arbitrary file <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[5,52,4,557],"class_list":["post-3431","post","type-post","status-publish","format-standard","hentry","category-8-administracion-del-sistema","tag-5","tag-administracion","tag-man8","tag-pam_listfile"],"gutentor_comment":0,"_links":{"self":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/3431","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/comments?post=3431"}],"version-history":[{"count":0,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/3431\/revisions"}],"wp:attachment":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/media?parent=3431"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/categories?post=3431"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/tags?post=3431"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}