System user tracking for login on email
For every Linux system orientated work, which going for development and production purpose, system admin need to follow-up system user activity.
But it is very hard to login every system for checking the user activity when you have number of systems.
You need to fix a policy when you can do every work without any problem with linux systems.
Linux system user tracking is one of the activity that has own importance.
I use this method for maintain my user tracking over email.
It is a simple method that you can add to your system is given below:-
1. You can add the following line for specific to user in their $HOME/.bash_profile
or to apply this setting system wise then add it in /etc/profile.d/ folder as a saperate file
[root@localhost ~]# cat /etc/profile.d/mail-alert.sh
echo "ALERT - User (`whoami`) Shell Access on:"`hostname` `date` `who` | mail -s "Alert: `hostname` User (`whoami`) Access from `who | cut -d"(" -f2 | cut -d")" -f1`" Admin_Email_ID@gmail.com
Here you need to change only Admin_Email_ID@gmail.com with your required email id where you want to receive emails.