Server Administration & Management

How to Email Alert on Root SSH Login

If you want to receive email alert when someone makes a root login to the Server.

1. open the file /root/.bashrc

# vi /root/.bashrc

2. Scroll to the end of the file then add the following:

echo ‘ALERT – Root Shell Access (YourserverName) on:’ `date` `who` | mail -s “Alert: Root Access from `who | cut -d'(‘ -f2 | cut -d’)’ -f1`” you@yourdomain.com

September 10, 2011 - Posted by | Mail, Security, SSH, Tips & Tricks | , , , ,

1 Comment »

  1. Good article. Its realy good. More information help me.

    Comment by Rosalba | October 21, 2011 | Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: