Email Alert on SSH Login

by Nish Vamadevan on 22/04/2012 · 0 comments

The following method can be used when a user login to a linux machine, an email will be sent with IP information.

For this to work, you need to have the program mutt installed.

Then add the following to the user’s .bashrc file, which is located in /home/$user/.bashrc

echo `who` | /usr/bin/mutt -s "SSH Alert" email@address.here

For example, if you want an email sent everytime the user root login, edit the file /home/root/.bashrc and add the above code.

Previous post:

Next post: