Community Forums
Connect with us on LinkedIn
Community Notice
+ Reply to Thread
Results 1 to 7 of 7
  1. #1
    Member
    Join Date
    Nov 2007
    Posts
    858

    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 07:48 AM.

  2. #2

  3. #3

  4. #4
    Member
    Join Date
    Nov 2007
    Posts
    858

    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
    7,158
    cPanel/Enkompass 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
    Member
    Join Date
    Nov 2007
    Posts
    858

    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
    Member
    Join Date
    Nov 2007
    Posts
    858

    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 & Tags
Similar threads

  1. Root access alert email
    By Lyttek in forum cPanel and WHM Discussions
    Replies: 7
    Last Post: 06-03-2007, 03:28 AM
  2. SSH root login DENIED
    By Lestat in forum cPanel and WHM Discussions
    Replies: 6
    Last Post: 11-18-2006, 01:29 AM
  3. Replies: 2
    Last Post: 09-29-2006, 01:27 PM
  4. Mail alert when someone logs into your SSH
    By d4rkl0rd in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 07-10-2004, 02:22 PM
  5. WHM root login lost - ssh still OK
    By dennism in forum cPanel and WHM Discussions
    Replies: 4
    Last Post: 06-23-2004, 05:24 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube