By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,403 Members | 1,089 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,403 IT Pros & Developers. It's quick & easy.

Trapping user logins in python ( post #1)

P: n/a
I am writting a daemon in python which should start at system start up
with all inet.d serviceson an NIS server. Then it should listen to any
user login and then start a new process for that user on his login
which will continue throughout his entire session.

Can anyone give any help or any suggestion or any useful links.

thinkgeek

Jul 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)

iD8DBQFCyXaUJd01MZaTXX0RApmQAJ41lq8SkqrF/M9oIsVDqBYHNqCvtQCePrO6
ypzmTuy274Jn0ZoHZI2M0n4=
=I3u+
-----END PGP SIGNATURE-----

Jul 21 '05 #2

P: n/a
On Monday 04 July 2005 13:49, Jeff Epler wrote:
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


If you'd like to hack and slash your way to a solution then you could run
"watch who" in a daemon that then sed's the output to your desired format and
then dumps it to a log/notification.
Jul 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.