Results 1 to 2 of 2

Thread: E-mail Alert on Root SSH Login

  1. #1
    Join Date
    May 2009
    Hell , Wanna Come ??

    Red face

    Want to be notified instantly when someone logs into your server as root? No problem, check out this nice tutorial on email notification for root logins. Keeping track of who logs into your server and when is very important, especially when you're dealing with the super user account. We recommend that you use an email address not hosted on the server your sending the alert from.

    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`"

    Replace YourServerName with the handle for your actual server
    Replace 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.

    Note: This is a great tool for servers that have multiple admins or if you give someone SSH access for whatever reason, although you should give out the root password to as few people as humanly possible and be sure to change it often.

    This will not magically alert you when a hacker runs the latest kernel exploit on your server and logs into SSH because they will create their own SSH/telnet connection. You should keep your system up to date, install a firewall and follow the latest security releases.
    Never argue with an idiot; First he takes you down to his level and then he beats you with experience.

  2. #2
    Join Date
    May 2009
    In a Party
    if ssh is secure, then i plan on doing this...

Similar Threads

  1. Replies: 0
    Last Post: 22 May, 2011, 12:39 PM
  2. Alert!!!!!!!!!! Da King of da Wackos is here!!!!!!
    By ruben in forum Introduction Forum
    Replies: 19
    Last Post: 22 November, 2009, 08:06 AM
  3. configuring to translate root folder?
    By moltovivo1 in forum Translation Script Support
    Replies: 12
    Last Post: 6 August, 2009, 12:10 PM
  4. Newbie alert!!!!
    By CreativHost in forum Introduction Forum
    Replies: 6
    Last Post: 25 May, 2009, 10:18 AM
  5. Disable Direct Root Logins
    By mega in forum Managing
    Replies: 1
    Last Post: 14 May, 2009, 09:16 AM

Tags for this Thread


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts