Trapping user logins in python ( post #1)

Jeff Epler jepler at unpythonic.net
Mon Jul 4 19:49:11 CEST 2005


I don't know of a portable way for an inetd-style daemon to "listen" for
user logins.

On some systems (including RedHat/Fedora and debian), you may be able to
use PAM to do this.  (pam modules don't just perform authentication,
they can take other actions.  As an example, pam_lastlog "prints the
last login on successful login".  I'm not sure what priviledge a pam
module has when it executes.

A more standard way to do this would be to place lines in /etc/profile
/etc/csh.login and so forth for any other shells used on your system.
RedHat-style systems have an /etc/profile.d where you can drop a file
that will be executed at login, too.  This will, of course, be executed
with the user's privilege level.  Another problem with this approach is
that /etc/profile is executed for a "login shell", but a graphical login
is not a login shell.

Jeff
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20050704/cdc932b4/attachment.sig>


More information about the Python-list mailing list