email notifications when users login

classic Classic list List threaded Threaded
21 messages Options
12
Reply | Threaded
Open this post in threaded view
|

email notifications when users login

Morgan Walker

Hey guys,

 

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.

 

Thanks in advance,

 

Morgan

 

Morgan Walker
Systems Administrator/Engineer
M•CAM, Inc.

Omni Business Center

210 Ridge-McIntire Rd., Suite 300

Charlottesville, VA 22903
434.979.7240 x311 

 

http://www.m-cam.com
=========================================================
This message, including any attachments, is intended solely for the use
of the named recipient(s) and may contain confidential and/or
privileged information.  Any unauthorized review, use, disclosure or
distribution of this communication(s) is expressly prohibited.
If you are not the intended recipient, please contact the sender by
reply e-mail and destroy any and all copies of the original message.
Thank you.
=========================================================

 

Reply | Threaded
Open this post in threaded view
|

Re: email notifications when users login

Gregory Arntson
Morgan,


On 9/18/06, Morgan Walker <[hidden email]> wrote:

Hey guys,

 

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.

 

Thanks in advance,

 

Morgan

 

Morgan Walker
Systems Administrator/Engineer
M•CAM, Inc.

Omni Business Center

210 Ridge-McIntire Rd., Suite 300

Charlottesville, VA 22903
434.979.7240 x311 

 

<a href="http://www.m-cam.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)"> http://www.m-cam.com
=========================================================
This message, including any attachments, is intended solely for the use
of the named recipient(s) and may contain confidential and/or
privileged information.  Any unauthorized review, use, disclosure or
distribution of this communication(s) is expressly prohibited.
If you are not the intended recipient, please contact the sender by
reply e-mail and destroy any and all copies of the original message.
Thank you.
=========================================================

 


Reply | Threaded
Open this post in threaded view
|

Re: email notifications when users login

Gregory Arntson
In reply to this post by Morgan Walker
Let's try not hitting the enter key this time...  Morgan, if for examples all of the users use the bash shell you could create a .bashrc that and the end of everything would notify the intended admins when the person logged in. From there all you would need to do is to copy it to all of the home directories of the users.

Greg

On 9/18/06, Morgan Walker <[hidden email]> wrote:

Hey guys,

 

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.

 

Thanks in advance,

 

Morgan

 

Morgan Walker
Systems Administrator/Engineer
M•CAM, Inc.

Omni Business Center

210 Ridge-McIntire Rd., Suite 300

Charlottesville, VA 22903
434.979.7240 x311 

 

<a href="http://www.m-cam.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)"> http://www.m-cam.com
=========================================================
This message, including any attachments, is intended solely for the use
of the named recipient(s) and may contain confidential and/or
privileged information.  Any unauthorized review, use, disclosure or
distribution of this communication(s) is expressly prohibited.
If you are not the intended recipient, please contact the sender by
reply e-mail and destroy any and all copies of the original message.
Thank you.
=========================================================

 


Reply | Threaded
Open this post in threaded view
|

Re: email notifications when users login

Manuel García-2
In reply to this post by Morgan Walker
I'm not quite sure if this is the right list to ask that kind of
question, but, there is a package name logcheck, it send email for
everything that happend on system logs, and anything else you said,
also you can use perl-like regular expresion to filter the email that
logcheck sends to you, read the documentation about it.
Enjoy.

On 9/18/06, Morgan Walker <[hidden email]> wrote:

>
>
>
>
> Hey guys,
>
>
>
> 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.
>
>
>
> Thanks in advance,
>
>
>
> Morgan
>
>
>
> Morgan Walker
>  Systems Administrator/Engineer
>  M•CAM, Inc.
>  Omni Business Center
>
> 210 Ridge-McIntire Rd., Suite 300
>
> Charlottesville, VA 22903
>  434.979.7240 x311
>
>
>
> http://www.m-cam.com
>  =========================================================
>  This message, including any attachments, is intended solely for the use
>  of the named recipient(s) and may contain confidential and/or
>  privileged information.  Any unauthorized review, use, disclosure or
>  distribution of this communication(s) is expressly prohibited.
>  If you are not the intended recipient, please contact the sender by
>  reply e-mail and destroy any and all copies of the original message.
>  Thank you.
>  =========================================================
>
>


--
Manuel Garcia.
Jefe de Informática CASEP.
Administrador de redes
Consultor independiente
Debian GNU/Linux Testing codename "Etch"

Reply | Threaded
Open this post in threaded view
|

RE: email notifications when users login

Morgan Walker
Thanks guys, think I am going to implement logcheck, it looks promising.

~Morgan

Morgan Walker
Systems Administrator/Engineer
M*CAM, Inc.
Omni Business Center
210 Ridge-McIntire Rd., Suite 300
Charlottesville, VA 22903
434.979.7240 x311


http://www.m-cam.com 
=========================================================
This message, including any attachments, is intended solely for the use
of the named recipient(s) and may contain confidential and/or
privileged information.  Any unauthorized review, use, disclosure or
distribution of this communication(s) is expressly prohibited.
If you are not the intended recipient, please contact the sender by
reply e-mail and destroy any and all copies of the original message.
Thank you.
=========================================================

-----Original Message-----
From: Manuel García [mailto:[hidden email]]
Sent: Monday, September 18, 2006 3:46 PM
To: Morgan Walker
Cc: [hidden email]
Subject: Re: email notifications when users login

I'm not quite sure if this is the right list to ask that kind of
question, but, there is a package name logcheck, it send email for
everything that happend on system logs, and anything else you said,
also you can use perl-like regular expresion to filter the email that
logcheck sends to you, read the documentation about it.
Enjoy.

On 9/18/06, Morgan Walker <[hidden email]> wrote:

>
>
>
>
> Hey guys,
>
>
>
> 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.
>
>
>
> Thanks in advance,
>
>
>
> Morgan
>
>
>
> Morgan Walker
>  Systems Administrator/Engineer
>  M*CAM, Inc.
>  Omni Business Center
>
> 210 Ridge-McIntire Rd., Suite 300
>
> Charlottesville, VA 22903
>  434.979.7240 x311
>
>
>
> http://www.m-cam.com
>  =========================================================
>  This message, including any attachments, is intended solely for the use
>  of the named recipient(s) and may contain confidential and/or
>  privileged information.  Any unauthorized review, use, disclosure or
>  distribution of this communication(s) is expressly prohibited.
>  If you are not the intended recipient, please contact the sender by
>  reply e-mail and destroy any and all copies of the original message.
>  Thank you.
>  =========================================================
>
>


--
Manuel Garcia.
Jefe de Informática CASEP.
Administrador de redes
Consultor independiente
Debian GNU/Linux Testing codename "Etch"

Reply | Threaded
Open this post in threaded view
|

Re: email notifications when users login

R. W. Rodolico-3
In reply to this post by Morgan Walker
I have a perl script that goes into daemon mode using log::tail that
notifies me via e-mail whenever anyone logs in from the command line. It
is open to anyone who wants it. Just let me know if you do. I think I even
commented it. Using log::tail it uses very few resources.

Rod

On Mon, September 18, 2006 14:34, Morgan Walker wrote:

> Hey guys,
>
>
>
>
> 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.
>
>
>
> Thanks in advance,
>
>
>
>
> Morgan
>
>
>
>
> Morgan Walker
> Systems Administrator/Engineer
> M*CAM, Inc.
> Omni Business Center
>
>
> 210 Ridge-McIntire Rd., Suite 300
>
>
> Charlottesville, VA 22903
> 434.979.7240 x311
>
>
>
>
> http://www.m-cam.com <http://www.m-cam.com>
> =========================================================
> This message, including any attachments, is intended solely for the use
> of the named recipient(s) and may contain confidential and/or privileged
> information.  Any unauthorized review, use, disclosure or distribution of
> this communication(s) is expressly prohibited. If you are not the intended
> recipient, please contact the sender by reply e-mail and destroy any and
> all copies of the original message. Thank you.
> =========================================================
>
>
>
>
>


--
R. W. "Rod" Rodolico
Daily Data, Inc.
POB 140465
Dallas  TX  75214-0465
214.827.2170

This is a private e-mail address for use only by clients of Daily Data.
Please do not forward or give out this e-mail address to anyone.


--
To UNSUBSCRIBE, email to [hidden email]
with a subject of "unsubscribe". Trouble? Contact [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: email notifications when users login

Marco Mueller
In reply to this post by Morgan Walker
Morgan Walker wrote:
> Hey guys,

Hi,

> 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.

A very simple script to notify me when users log on:

$ cat /etc/ssh/sshrc
#!/bin/bash

IFS="
"
nail -s "Login to <put Servername here> by $USER" root < .
$


where 'root' is the user this Mail is being mailed to. Nail is a mailer
like mail and expects a dot to commit EOM.

This also works even when the user has another shell, e.g. scponly.


Ciao!
Marco


--
To UNSUBSCRIBE, email to [hidden email]
with a subject of "unsubscribe". Trouble? Contact [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: email notifications when users login

Izak Burger
In reply to this post by Morgan Walker
On 9/18/06, Morgan Walker <[hidden email]> 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


--
To UNSUBSCRIBE, email to [hidden email]
with a subject of "unsubscribe". Trouble? Contact [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: email notifications when users login

Dave Carrigan
In reply to this post by Marco Mueller
On Monday 18 September 2006 15:08, Marco Müller wrote:

> IFS="
> "
> nail -s "Login to <put Servername here> by $USER" root < .
> $
>
>
> where 'root' is the user this Mail is being mailed to. Nail is a mailer
> like mail and expects a dot to commit EOM.

Just to nitpick, but your syntax of "nail ... <." is not sending a dot to
nail. It's redirecting the contents of the file ".", which is the current
directory. If you want to send a dot to a command you should do

echo . | nail -s ...

--
Dave Carrigan
Seattle, WA, USA
[hidden email] | http://www.rudedog.org/
UNIX-Apache-Perl-Linux-Firewalls-LDAP-C-C++-DNS-PalmOS-PostgreSQL-MySQL-Postfix

attachment0 (196 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: email notifications when users login

Marco Mueller
Dave Carrigan wrote:

> On Monday 18 September 2006 15:08, Marco Müller wrote:
>
>> IFS="
>> "
>> nail -s "Login to <put Servername here> by $USER" root < .
>> $
>>
>>
>> where 'root' is the user this Mail is being mailed to. Nail is a mailer
>> like mail and expects a dot to commit EOM.
>
> Just to nitpick, but your syntax of "nail ... <." is not sending a dot to
> nail. It's redirecting the contents of the file ".", which is the current
> directory. If you want to send a dot to a command you should do
>
> echo . | nail -s ...

Thank you for that hint.
I don't even know how I came to that idea of "< .", not strangely enough
that worked for me.

I've changed that, all because of the elegance ;)


Ciao!
Marco


--
To UNSUBSCRIBE, email to [hidden email]
with a subject of "unsubscribe". Trouble? Contact [hidden email]

Reply | Threaded
Open this post in threaded view
|

[OT] Re: email notifications when users login

linux4michelle
In reply to this post by Gregory Arntson
Am 2006-09-18 15:44:26, schrieb Gregory Arntson:
> Let's try not hitting the enter key this time...  Morgan, if for examples
> all of the users use the bash shell you could create a .bashrc that and the
> end of everything would notify the intended admins when the person logged
> in. From there all you would need to do is to copy it to all of the home
> directories of the users.

But is $USER can get a shell, he/she can modify the .bashrc

Note:  This is Off-Topic on this List.
       <[hidden email]> would be better.

Thanks, Greetings and nice Day
    Michelle Konzack
    Systemadministrator
    Tamay Dogan Network
    Debian GNU/Linux Consultant


--
Linux-User #280138 with the Linux Counter, http://counter.li.org/
##################### Debian GNU/Linux Consultant #####################
Michelle Konzack   Apt. 917                  ICQ #328449886
                   50, rue de Soultz         MSM LinuxMichi
0033/6/61925193    67100 Strasbourg/France   IRC #Debian (irc.icq.com)


--
To UNSUBSCRIBE, email to [hidden email]
with a subject of "unsubscribe". Trouble? Contact [hidden email]

Reply | Threaded
Open this post in threaded view
|

[OT] Re: email notifications when users login

linux4michelle
In reply to this post by Morgan Walker
Hi Morgan,

Am 2006-09-18 15:34:30, schrieb Morgan Walker:
> Hey guys,
>
> 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.


#/etc/profile

echo "The User  ${LOGNAME}  has loged in." |\
    sendmail -f [hidden email]  [hidden email]



Thanks, Greetings and nice Day
    Michelle Konzack
    Systemadministrator
    Tamay Dogan Network
    Debian GNU/Linux Consultant


--
Linux-User #280138 with the Linux Counter, http://counter.li.org/
##################### Debian GNU/Linux Consultant #####################
Michelle Konzack   Apt. 917                  ICQ #328449886
                   50, rue de Soultz         MSM LinuxMichi
0033/6/61925193    67100 Strasbourg/France   IRC #Debian (irc.icq.com)


--
To UNSUBSCRIBE, email to [hidden email]
with a subject of "unsubscribe". Trouble? Contact [hidden email]

Reply | Threaded
Open this post in threaded view
|

RE: [OT] Re: email notifications when users login

Morgan Walker

Thanks Michelle that worked perfect.  Is there an easy variable I could
throw in there that you know off hand which would include the time
(MM/DD/YYYY) as well?

Thanks again guys

-----Original Message-----
From: Michelle Konzack [mailto:[hidden email]]
Sent: Tuesday, September 19, 2006 6:59 PM
To: [hidden email]
Subject: [OT] Re: email notifications when users login

Hi Morgan,

Am 2006-09-18 15:34:30, schrieb Morgan Walker:
> Hey guys,
>
> 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.


#/etc/profile

echo "The User  ${LOGNAME}  has loged in." |\
    sendmail -f [hidden email]  [hidden email]



Thanks, Greetings and nice Day
    Michelle Konzack
    Systemadministrator
    Tamay Dogan Network
    Debian GNU/Linux Consultant


--
Linux-User #280138 with the Linux Counter, http://counter.li.org/
##################### Debian GNU/Linux Consultant #####################
Michelle Konzack   Apt. 917                  ICQ #328449886
                   50, rue de Soultz         MSM LinuxMichi
0033/6/61925193    67100 Strasbourg/France   IRC #Debian (irc.icq.com)


--
To UNSUBSCRIBE, email to [hidden email]
with a subject of "unsubscribe". Trouble? Contact
[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [OT] Re: email notifications when users login

Freddie Cash
On Thursday 21 September 2006 12:37 pm, Morgan Walker wrote:
> Thanks Michelle that worked perfect.  Is there an easy variable I could
> throw in there that you know off hand which would include the time
> (MM/DD/YYYY) as well?

$( date ) will add the current date and time.  You can read the man page
for date to find out how to format it so that it only shows the date or
only the time or both, etc.

$( ) will start a sub-shell that runs whatever commands you put between
the $( and ).

So you could do:
msg="The user  ${LOGNAME}  has logged into $( hostname ) at $( date )."
echo $msg | sendmail -s "User login"  [hidden email]

--
Freddie Cash, LPIC-2 CCNT CCLP      Network Support Technician
School District 73                  (250) 377-HELP [377-4357]
[hidden email]


--
To UNSUBSCRIBE, email to [hidden email]
with a subject of "unsubscribe". Trouble? Contact [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [OT] Re: email notifications when users login

Stephen Gran
In reply to this post by Morgan Walker
This one time, at band camp, Morgan Walker said:
>
> Thanks Michelle that worked perfect.  Is there an easy variable I could
> throw in there that you know off hand which would include the time
> (MM/DD/YYYY) as well?

echo "The User ${LOGNAME} has logged in at $(date -R)" |\
     mail -s "user login" [hidden email]
--
 -----------------------------------------------------------------
|   ,''`.                                            Stephen Gran |
|  : :' :                                        [hidden email] |
|  `. `'                        Debian user, admin, and developer |
|    `-                                     http://www.debian.org |
 -----------------------------------------------------------------

signature.asc (196 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

RE: [OT] Re: email notifications when users login

Hubert Chathi-2
In reply to this post by Morgan Walker
On 2006-09-21 15:37:56 -0400 Morgan Walker <[hidden email]> wrote:

> Thanks Michelle that worked perfect.  Is there an easy variable I
> could
> throw in there that you know off hand which would include the time
> (MM/DD/YYYY) as well?

echo "The User ${LOGNAME} has loged in on `date`." |\ ...

(those are backticks around "date")

Run "date --help" to see how to change the date format if you want
something different than the default.

--
Hubert Chan - email & Jabber: [hidden email] - http://www.uhoreg.ca/
PGP/GnuPG key: 1024D/124B61FA   (Key available at wwwkeys.pgp.net)
Fingerprint: 96C5 012F 5F74 A5F7 1FF7  5291 AF29 C719 124B 61FA


--
To UNSUBSCRIBE, email to [hidden email]
with a subject of "unsubscribe". Trouble? Contact [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [OT] Re: email notifications when users login

Bernd Eckenfels
In reply to this post by Morgan Walker
In article <[hidden email]> you wrote:
> Thanks Michelle that worked perfect.  Is there an easy variable I could
> throw in there that you know off hand which would include the time
> (MM/DD/YYYY) as well?

NOW=`date`

Gruss
Bernd


--
To UNSUBSCRIBE, email to [hidden email]
with a subject of "unsubscribe". Trouble? Contact [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [OT] Re: email notifications when users login

Horst Pflugstaedt
In reply to this post by Morgan Walker
On Thu, Sep 21, 2006 at 03:37:56PM -0400, Morgan Walker wrote:
>
> Thanks Michelle that worked perfect.  Is there an easy variable I could
> throw in there that you know off hand which would include the time
> (MM/DD/YYYY) as well?

Apart from the suggestions to use ${ date }, does the date of the mail
not suffice?

Gruss,
Horst


--
To UNSUBSCRIBE, email to [hidden email]
with a subject of "unsubscribe". Trouble? Contact [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [OT] Re: email notifications when users login

linux4michelle
In reply to this post by Morgan Walker
Am 2006-09-21 15:37:56, schrieb Morgan Walker:
>
> Thanks Michelle that worked perfect.  Is there an easy variable I could
> throw in there that you know off hand which would include the time
> (MM/DD/YYYY) as well?

----8<----------------------------------------------------------
#/etc/profile

LOGINTIME=$(date "+%Y-%m-%d %H:%M:%S")

echo "The User  ${LOGNAME}  has loged at ${LOGINTIME}." |\
    sendmail -f [hidden email]  [hidden email]
----8<----------------------------------------------------------

Thanks, Greetings and nice Day
    Michelle Konzack
    Systemadministrator
    Tamay Dogan Network
    Debian GNU/Linux Consultant


--
Linux-User #280138 with the Linux Counter, http://counter.li.org/
##################### Debian GNU/Linux Consultant #####################
Michelle Konzack   Apt. 917                  ICQ #328449886
                   50, rue de Soultz         MSM LinuxMichi
0033/6/61925193    67100 Strasbourg/France   IRC #Debian (irc.icq.com)


--
To UNSUBSCRIBE, email to [hidden email]
with a subject of "unsubscribe". Trouble? Contact [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [OT] Re: email notifications when users login

Dale Amon
In reply to this post by Morgan Walker
On Thu, Sep 21, 2006 at 03:37:56PM -0400, Morgan Walker wrote:
>
> Thanks Michelle that worked perfect.  Is there an easy variable I could
> throw in there that you know off hand which would include the time
> (MM/DD/YYYY) as well?

TIME=`date +%m/%d/%Y`

--
------------------------------------------------------
             Artemis Systems Development
   Dale Amon     [hidden email]    +44-7802-188325
       International linux systems consultancy
     Hardware & software system design, security
    and networking, systems programming and Admin
              "Have Laptop, Will Travel"
------------------------------------------------------


--
To UNSUBSCRIBE, email to [hidden email]
with a subject of "unsubscribe". Trouble? Contact [hidden email]

12