This is the script used to send email when any user logged in to the Linux server.

Step 1 : Login to the server
Step 2 : vi .bash_profile
Step 3 : Copy paste the script below

echo ‘ALERT – Root Shell Access (root@IP ADDRESS) on:’ `date` `who` | mail -s “Alert: Root Access from `who | cut -d”(” -f2 | cut -d”)” -f1`”  <mailaccount>

Step 4 : Save and exit
Step 5 : Now log out and login to the server. You will receive an mail to “hemanthpresence@gmail.com”.

Note: Change the email ID and the IP ADDRESS to yours.

Leave a Reply

This website stores cookies on your computer. These cookies are used to provide a more personalized experience and to track your whereabouts around our website in compliance with the European General Data Protection Regulation. If you decide to to opt-out of any future tracking, a cookie will be setup in your browser to remember this choice for one year.

Accept or Deny