| Wednesday June 1st 2016

HOWTO: Receive an email when someone logs in as root

Login as root. (If you disabled root SSH logins, login with your other username, and su to root)


nano .bash_profile

At the end of the file put this:
echo 'ALERT - Root Shell Access on:' `date` `who` | mail -s "Alert: Root Access from `who | awk '{print $6}'`" offsite-email-address@gmail.com

Make sure that the email address you use is not hosted on the server as an attacker could simply delete the e-mail and notifications, and you would never know.

Related Posts: On this day...

Reader Feedback

One Response to “HOWTO: Receive an email when someone logs in as root”

  1. Kindssories says:

    Didn’t know about it. Very nice information. Submitted this post to Google News Reader.

Leave a Reply

You must be logged in to post a comment.