Welcome to UltratechHost Forum, Guest. Please take the time to register if you haven't, or click

Tags
Author: UltratechHost - Replies: 0 - Views: 3234
E-mail Alert on Root SSH Login
E-mail Alert on Root SSH Login

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!
Author: UltratechHost - Replies: 0 - Views: 3513
Alert when an login is done to SSH server
For added security, I modified the .bashrc profile for any users that may have shell access, and added the following, so that when the user logs in, it sends out an email, letting you know that someone has logged in.

Code:
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
Of course, you need to modify the (Yourservername) and you@yourdomain.com part.

This little code get