≡ Menu

Email Alert on SSH Login

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.

Comments on this entry are closed.

Next post:

Previous post:

Copyright © Nish Vamadevan 2002-2017. All Rights Reserved. Terms and Policies.