man-pages/man8/pam_exec.8.html
2021-03-31 01:06:50 +01:00

249 lines
4.9 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of PAM_EXEC</TITLE>
</HEAD><BODY>
<H1>PAM_EXEC</H1>
Section: Linux-PAM Manual (8)<BR>Updated: 05/18/2017<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
pam_exec - PAM module which calls an external command
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<DL COMPACT>
<DT id="1">
<B>pam_exec.so</B> [debug] [expose_authtok] [seteuid] [quiet] [stdout] [log=<I>file</I>] [type=<I>type</I>] <I>command</I> [<I>...</I>]
</DL>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
<P>
<DD>pam_exec is a PAM module that can be used to run an external command.
<P>
The child's environment is set to the current PAM environment list, as returned by
<B><A HREF="/cgi-bin/man/man2html?3+pam_getenvlist">pam_getenvlist</A></B>(3)
In addition, the following PAM items are exported as environment variables:
<I>PAM_RHOST</I>,
<I>PAM_RUSER</I>,
<I>PAM_SERVICE</I>,
<I>PAM_TTY</I>,
<I>PAM_USER</I>
and
<I>PAM_TYPE</I>, which contains one of the module types:
<B>account</B>,
<B>auth</B>,
<B>password</B>,
<B>open_session</B>
and
<B>close_session</B>.
<P>
Commands called by pam_exec need to be aware of that the user can have controll over the environment.
<A NAME="lbAE">&nbsp;</A>
<H2>OPTIONS</H2>
<P>
<P>
<B>debug</B>
<DL COMPACT><DT id="2"><DD>
Print debug information.
</DL>
<P>
<B>expose_authtok</B>
<DL COMPACT><DT id="3"><DD>
During authentication the calling command can read the password from
<B><A HREF="/cgi-bin/man/man2html?3+stdin">stdin</A></B>(3). Only first
<I>PAM_MAX_RESP_SIZE</I>
bytes of a password are provided to the command.
</DL>
<P>
<B>log=</B><B></B><I>file</I>
<DL COMPACT><DT id="4"><DD>
The output of the command is appended to
file
</DL>
<P>
<B>type=</B><B></B><I>type</I>
<DL COMPACT><DT id="5"><DD>
Only run the command if the module type matches the given type.
</DL>
<P>
<B>stdout</B>
<DL COMPACT><DT id="6"><DD>
Per default the output of the executed command is written to
/dev/null. With this option, the stdout output of the executed command is redirected to the calling application. It's in the responsibility of this application what happens with the output. The
<B>log</B>
option is ignored.
</DL>
<P>
<B>quiet</B>
<DL COMPACT><DT id="7"><DD>
Per default pam_exec.so will echo the exit status of the external command if it fails. Specifying this option will suppress the message.
</DL>
<P>
<B>seteuid</B>
<DL COMPACT><DT id="8"><DD>
Per default pam_exec.so will execute the external command with the real user ID of the calling process. Specifying this option means the command is run with the effective user ID.
</DL>
<A NAME="lbAF">&nbsp;</A>
<H2>MODULE TYPES PROVIDED</H2>
<P>
All module types (<B>auth</B>,
<B>account</B>,
<B>password</B>
and
<B>session</B>) are provided.
<A NAME="lbAG">&nbsp;</A>
<H2>RETURN VALUES</H2>
<P>
<P>
PAM_SUCCESS
<DL COMPACT><DT id="9"><DD>
The external command was run successfully.
</DL>
<P>
PAM_SERVICE_ERR
<DL COMPACT><DT id="10"><DD>
No argument or a wrong number of arguments were given.
</DL>
<P>
PAM_SYSTEM_ERR
<DL COMPACT><DT id="11"><DD>
A system error occurred or the command to execute failed.
</DL>
<P>
PAM_IGNORE
<DL COMPACT><DT id="12"><DD>
<B>pam_setcred</B>
was called, which does not execute the command. Or, the value given for the type= parameter did not match the module type.
</DL>
<A NAME="lbAH">&nbsp;</A>
<H2>EXAMPLES</H2>
<P>
Add the following line to
/etc/pam.d/passwd
to rebuild the NIS database after each local password change:
<P>
<DL COMPACT><DT id="13"><DD>
<PRE>
password optional pam_exec.so seteuid /usr/bin/make -C /var/yp
</PRE>
</DL>
<P>
This will execute the command
<P>
<DL COMPACT><DT id="14"><DD>
<PRE>
make -C /var/yp
</PRE>
</DL>
<P>
with effective user ID.
<A NAME="lbAI">&nbsp;</A>
<H2>SEE ALSO</H2>
<P>
<B><A HREF="/cgi-bin/man/man2html?5+pam.conf">pam.conf</A></B>(5),
<B><A HREF="/cgi-bin/man/man2html?5+pam.d">pam.d</A></B>(5),
<B><A HREF="/cgi-bin/man/man2html?7+pam">pam</A></B>(7)
<A NAME="lbAJ">&nbsp;</A>
<H2>AUTHOR</H2>
<P>
pam_exec was written by Thorsten Kukuk &lt;<A HREF="mailto:kukuk@thkukuk.de">kukuk@thkukuk.de</A>&gt; and Josh Triplett &lt;<A HREF="mailto:josh@joshtriplett.org">josh@joshtriplett.org</A>&gt;.
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="15"><A HREF="#lbAB">NAME</A><DD>
<DT id="16"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="17"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="18"><A HREF="#lbAE">OPTIONS</A><DD>
<DT id="19"><A HREF="#lbAF">MODULE TYPES PROVIDED</A><DD>
<DT id="20"><A HREF="#lbAG">RETURN VALUES</A><DD>
<DT id="21"><A HREF="#lbAH">EXAMPLES</A><DD>
<DT id="22"><A HREF="#lbAI">SEE ALSO</A><DD>
<DT id="23"><A HREF="#lbAJ">AUTHOR</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:06:14 GMT, March 31, 2021
</BODY>
</HTML>