This Email alert are working when some user are getting into server or which we called login to server using SSH connection, then admin will know through his or her email. Example i have user with name “amin”, then my server will tell me ( as admin ) through email that user “amin” has logged with IP and the time he / she get connect.
This is not important actuallly, because we ussualy find it on /var/log/auth.log who are get connected. But for the sake miserable log file ..^^..we could documented it through email.
So to the point is:
- Install mailx and mailutils program (linux ubuntu)
- You login as you auth ( “amin” as example ) .
- After you get to your¬¨‚Ä† home (“/home/amin/” as exsample) please edit .bashrc file.
- Add this on the bottom line
“echo ‘ALERT – User Shell Access (YourserverName) on:’ `date` `who` | mail -s “Alert: User Access from `who | cut -d”(” -f2 | cut -d”)” -f1`” firstname.lastname@example.org (without *”* thing )
Change yourservername with yours name server and you@yourdomain to your email address.
- Try to save and re login again
After this you will get warn about who are getting connected with your “username” from your email. For the warning text you could be creative i think… 😀