Re: Passwd Change -> Email

From: Bandi (05.08@web.de)
Date: 09/02/01


Date: Sun, 2 Sep 2001 17:53:15 +0200 (CEST)
From: Bandi <05.08@web.de>
To: Administrator <lists@digitalplace.org>
Subject: Re: Passwd Change -> Email
Message-ID: <Pine.LNX.4.21.0109021534540.1367-100000@ikarus.not.mil>


> I am wondering if anyone has a program that will set a linux computer to
> email to a specified account when the passwd/shadow file changes. I
> have a linux box that I do not use everyday, and is a single hole in a
> firewall. The only port open is ssh and I want the box to email me if
> the password file changes. If anybody has an app that can do this I
> would be very appreciative. Thank you.

Michael,

You could write a shell script for that. That's a pretty simple way and it
might not be very secure. You could too build your own passwd-application.

#!/bin/sh

/usr/sbin/.passwd__ $@

if [`echo $?` -e 0]
echo -e "Hi!\nYour password has been changed on `date` maybe by yourself.\nBye!" |
mail `id -un` -s password-change

#EOF

That one is a very simple example. If you fear someone could get root and
then change passwords, you have to use grep to get the user's name whose
password was changed (but if someone got root this way is really
insecure). In case that you use a script for your suppose you
need to change the name of the passwd-binary, put it to some directory
that is not readable by normal users + chmod the script 0711 so that
normal users can not see it is just a script.

I hope I could help!
Best regards.
Bandi