Hosting Your Own Web Server: Things to Consider Published: Nov 28, 2006
  • Rating

    3/5

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.

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

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.
  • Rating

    3/5

Related Articles

Comments (5)

  • Gravatar - frantz
    frantz 14:14, August 17, 2007
    I know this report is a bit dated, but it was still helpful. I"ve been considring hosting my own server for a while and just came accross this article. Just wanted to say thank you and it helped a lot.
  • Gravatar - julz
    julz 23:23, November 4, 2009
    this article is very useful , im currently planning to build my own webserver, but i have some doubts and questions in mind that I would also like to ask here, <br />
    <br />
    can I use my local highspeed home internet for the server or I have to go for a business internet plan for these?, im worry about the ISP TOS but almost all thread ive read about home webhosting uses their local highspeed internet. Can you share your Ideas about these
  • Gravatar - Dedicated Server India
    Dedicated Server India 09:07, July 9, 2010
    <a href=" http://www.go4hosting.com">Dedicated Server India</a>
  • Gravatar - norhuda
    norhuda 09:50, September 22, 2010
    very good article
  • Gravatar - norhuda
    norhuda 09:51, September 22, 2010
    very good article

Add Your Thoughts

WebHostGear.com is a hosting directory, not a web host.

Copyright © 1998-2019 WebHostGear.com