Get your server issues fixed by our experts for a price starting at just 25 USD/Hour. Click here to register and open a ticket with us now!

Author Topic: How to get Email Alert when successful login Occurs?  (Read 13799 times)

0 Members and 1 Guest are viewing this topic.

mohitht

  • Guest
How to get Email Alert when successful login Occurs?
« 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)