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
echo `who` | /usr/bin/mutt -s "SSH Alert" email@example.com
For example, if you want an email sent everytime the user root login, edit the file
/home/root/.bashrc and add the above code.