::::Login Notification When User Logged into the Linux Machine:::::
Save above file.
If you want to add for all the users when you install a Linux server freshly go to /etc/skel
# cd /etc/skel
# vi .bashrc
echo "ALERT - User `who` Logan on:" `date` `who` | mail -s "Alert: User `who am i` logged on to `hostname`" aravikumar48@gmail.com
:wq
Save and exit
when you create a new user this files will copy to his home directory and when he logged into the machine it will send you a alert.
- Login into the Linux machine using root.
- In home path of root edit .bashrc file vi .bashrc
- Add below Lines
- echo "ALERT - Root Shell Accessed on:" `date` `who` | mail -s "Alert: Root shell Accessed on `hostname`" <YOUR EMAIL ID>
Save above file.
If you want to add for all the users when you install a Linux server freshly go to /etc/skel
# cd /etc/skel
# vi .bashrc
echo "ALERT - User `who` Logan on:" `date` `who` | mail -s "Alert: User `who am i` logged on to `hostname`" aravikumar48@gmail.com
:wq
Save and exit
when you create a new user this files will copy to his home directory and when he logged into the machine it will send you a alert.