User Tools

Site Tools


blog:send_email_on_root_login

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
blog:send_email_on_root_login [2009-07-02 06:52] brbblog:send_email_on_root_login [2009-07-02 07:09] (current) brb
Line 4: Line 4:
  
 Login as root and edit the file, ‘~/.bash_profile’. Near the bottom add this: Login as root and edit the file, ‘~/.bash_profile’. Near the bottom add this:
-  echo -e “Subject: Root Access\n\nALERT – Root Shell Access on: `date`, `who`\n” | ssmtp user@domain.com+  echo -e “Subject: Root Access\n\nALERT – Root Shell Access on: `date`, `who`\n” | mail -s "Root access" user@domain.com
  
 Now to test it, log out of root and then log back on as root. You should now get an alert that someone has logged in as root. This script shows the time and user. You can adjust the information accordingly depending on how detailed you want it. Now to test it, log out of root and then log back on as root. You should now get an alert that someone has logged in as root. This script shows the time and user. You can adjust the information accordingly depending on how detailed you want it.
blog/send_email_on_root_login.1246510373.txt.gz · Last modified: 2009-07-02 06:52 by brb