You could probably setup something in [tt]root[/tt]'s [tt].<shell>rc[/tt] that would send an email to you. This file is read when [tt]root[/tt] logs in. //Daniel
Or what I do is edit the root's .profile and add the following line:-
/backups/.logmein 2>&1 /dev/null
the file /backups/.logmein has the following contents:-
#!/bin/bash
email="someone@mydomain.co.uk"
Date=`/bin/date`
lastlog | mail -s "ROOT Just Logged in at $Date" $email
#end script
Then make it executable for root and every time root logs in a mail will be sent with the body containing the output of lastlog (useful to see where he/she connected from).
A similar process is useful for normal users but just grep off the username from lastlog ?
lastlog | grep fredbloggs | mail -s "Fred Bloggs Just Logged in at $Date" $email
works with "su - <user>" but not with "su <user>" for obvious reasons.
Enjoy
L.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.