Login from root send email

orfey

New member
Joined
Nov 25, 2005
Messages
2
Location
Bulgaria,Dimitrovgrad
Hello, my english is very bad.
I search script php or perl.

the script:

If login from root (php script read /var/log/messages or /var/log/secure/ ) send me email


php not read/write/ /var/log/messages/ ?
hoy i write script?

pls help
 
try this. this will send you an email whenver somone login as root.

1. Login to your server and su to root, I know the irony!

2. cd /root

3. pico .bashrc

4. Scroll to the end of the file then add the following:
echo 'ALERT - ServerName Root Access on:' `date` `who` | mail -s "Alert: Root Access from `who | cut -d'(' -f2 | cut -d')' -f1`" [email protected]

Replace ServerName with the handle for your actual server
Replace [email protected] with your actual email address

5. Crtl + X then Y

Now logout of SSH, close the connection and log back in! You should receive an email address of the root login alert a few minutes afterwards.
 
cool this script... i would like that it put a newline for every information.. itì's few hours that i try but doesnt work...

can u help me?

I would like this:

alert.....
date....
access from.....

it is possible?
 
Back
Top