Admin-Ahead Community

Linux => Control Panels => DirectAdmin => Topic started by: mohitht on January 11, 2014, 07:22:52 pm

Title: How to get Email Alert when successful login Occurs?
Post by: mohitht on January 11, 2014, 07:22:52 pm
Hi All,

For a better security method we can set a Mail alert when someone Login to our Servers as Root .

In order to set this we need to edit the .bashrc file

# vi .bashrc

Add the following line below in .bashrc file

# echo -n 'ALERT - Root Shell Access (servername) on:' `date` `who` | mail -s "Alert: Root Access from `who | cut -d"(" -f2 | cut -d")" -f1`" email address


We can also set this method when someone access through SSH.

Goto the directory

cd /root/.ssh


Create a file name "rc"

# vi rc

Add the following line in the new "rc" file

echo -n 'ALERT - Root Shell Access (servername) on:' `date` `who`  | mail -s "Alert: Root Access from `who | cut -d"(" -f2 | cut -d")" -f1`" email address


That's It  :)


Regards,
Mohith  :D 8)