Login to the server using as root ID.
Ensure that you’re at home directory of root. open the .bash_profile for editing using vi editor as shown below
vi .bash_profile
Scroll down to the end of the file and add the following line:
echo 'ALERT - Root Shell Access on:' `date` `who` mail -s "Alert: Root Access from `who cut -d"(" -f2 cut -d")" -f1`" user@example.com
Replace user@email.com with the actual email account address that you want to the root access alert notification been sent to. Note that you can change the text contains in the email alert too. The text starting with first ALERT is written as email body, and you can add in other info such as host name or change the wordings. The second Alert is the email title which you can enter your own text.
Regards,
Sukhwinder Singh
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.