VPS Hosting KNOWLEDGEBASE
1page_img1
How to get your server to email you when someone logs in as root.

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`"[email protected]


Replace YourServerName with the handle for your actual server

Replace [email protected] 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.

Customer Feedback...

1page_img1
Mark Rightson...
"This is by far the best service I have ever seen from a server hosting provider. Their virtual servers are no different than the dedicated server I moved from and they managed to import my dedicated server.. like magic! Thanks guys for the excellent service"
1page_img1
Bill Meyer...
"I got my first VMware server from vps-hosting.ca and I have to say I was very impressed. I realize I was wasting money on my dedicated server as these virtuals seem to perform extremely well. Also I really didn't expect to have the server up and running in 3 minutes which was great"