[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: email notifications when users login



On 9/18/06, Morgan Walker <jmw@m-cam.com> wrote:
I was just wondering if there was a package/script out there that could be
used to notify the sys. admin every time a user logged into a debian system.

The simplest two ways, as was already noted, is to add something to
/etc/profile or some other script that is called at login time that
will notify you in some or other manner, or to parse your log files.
I remember years ago there used to be a program similar to xconsole
that would highlight certain lines for you.

Strangely enough, someone else asked me about this too a while ago.
We talked about doing this using pam.  A couple of years ago I wrote a
simple pam (pluggable authentication module) that does session
management -- whenever a user logs in or out it calls a script.

Initially I only cared about session end, I used it with kdm at the
time so that when a user's kde session ends it would kill off certain
processes which at the time were known to "hang arround in the
background", and unmount floppy drives.  We used it in a lab setting
at a university.  This little module quickly expanded, today it does
both session and authentication management and can hook into login or
logout.

It is called pam_script, non-officially renamed to libpam-script to
match debian policy, and there are two places you can get it, on
mentors.debian.net, or on freshmeat (which will redirect you to some
google address that currently only hosts a subversion repo).
Unfortunately it isn't part of debian (yet).  Sponsors welcome.

http://mentors.debian.net/debian/pool/main/l/libpam-script/

I was thinking that a very cool way to implement this into the system
would be to use dbus: when a user logs in this would inject an signal
into the dbus system, and an interested application can listen for
this event somewhere and display it on screen.  This is rather an
elaborate idea, but one that can certainly be extended to other uses.
You could write a generic send and receive program that can be used in
other ways as well (or use the dbus-send and dbus-viewer programs).
An example of writing dbus server and client can be found here:

http://www-128.ibm.com/developerworks/opensource/library/l-dbus.html

If I had more time I'd probably do it too, for the moment I put this
idea out there in case someone feels like toying with it.

Cheers,
Izak



Reply to: