Skip to content

Instantly share code, notes, and snippets.

@natali
Created November 23, 2010 08:19
Show Gist options
  • Save natali/711451 to your computer and use it in GitHub Desktop.
Save natali/711451 to your computer and use it in GitHub Desktop.
Send email everytime someone login to root
# put in /root/.bashrc
echo 'ALERT - Root Shell Access on:' `date` `who | grep -v "203.24.76.33"` | mail -s "Alert: Root Access from `who | awk '{print $6}'| grep -v "203.24.76.33"`" [email protected]
@natali
Copy link
Author

natali commented Nov 23, 2010

Email are still sent when root/su-ing from valid IP 203.24.76.33. Should be using if .. fi but I don't know how :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment