Results 1 to 7 of 7

Thread: E-mail Alert on Root SSH Login

  1. #1
    Registered Member
    Join Date
    Nov 2007
    Posts
    926

    Arrow E-mail Alert on Root SSH Login

    Want to be notified instantly when someone logs into my server as root
    With date time & local IP address
    Is it possible to do this thing?
    Last edited by crazyaboutlinux; 06-03-2009 at 06:48 AM.

  2. #2

  3. #3
    Registered Member
    Join Date
    Jul 2006
    Posts
    292

  4. #4
    Registered Member
    Join Date
    Nov 2007
    Posts
    926

    Arrow

    Quote Originally Posted by PlatinumServerM View Post
    Sure you can do this /root/.bashrc
    what can i do to this /root/.bashrc

  5. #5
    cPanel Product Evangelist Infopro's Avatar
    Join Date
    May 2003
    Location
    Pennsylvania
    Posts
    11,329
    cPanel/WHM Access Level

    Root Administrator

    Lightbulb

    LFD does this. You might want to take a look at your CSF configuration. This is covered there along with email alerts for many other things as well.

    No need to edit that file, IMHO..

  6. #6
    Registered Member
    Join Date
    Nov 2007
    Posts
    926

    Arrow

    Quote Originally Posted by Infopro View Post
    LFD does this. You might want to take a look at your CSF configuration. This is covered there along with email alerts for many other things as well.

    No need to edit that file, IMHO..
    what exact to look in CSF configuration

  7. #7
    Registered Member
    Join Date
    Nov 2007
    Posts
    926

    Arrow

    after lot of googling i got below

    & its really doing great job

    Code:
    So lets get started!
    
    1. Login to your server and su to root, I know the irony!
    
    2. cd /root
    
    3. pico .bashrc
    
    4. 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
    
    Replace YourServerName with the handle for your actual server
    Replace you@yourdomain.com with your actual email address
    
    5. Crtl + X  then Y
    
    Now logout of SSH, close the connection and log back in! You should receive an email address of the root login alert a few minutes afterwards.

Similar Threads

  1. Ssh - Disable root login with ssh keys
    By cashgold in forum Security
    Replies: 6
    Last Post: 03-26-2014, 01:34 AM
  2. SSH login alert
    By popeye in forum Security
    Replies: 3
    Last Post: 01-21-2014, 07:29 AM
  3. SSH root login DENIED
    By Lestat in forum cPanel & WHM Discussions
    Replies: 6
    Last Post: 11-18-2006, 12:29 AM
  4. Mail alert when someone logs into your SSH
    By d4rkl0rd in forum cPanel & WHM Discussions
    Replies: 0
    Last Post: 07-10-2004, 01:22 PM
  5. WHM root login lost - ssh still OK
    By dennism in forum cPanel & WHM Discussions
    Replies: 4
    Last Post: 06-23-2004, 04:24 AM
bargain