[TUT] Get emails when someone logins into SSH

Status
Not open for further replies.

.:Raymond:.

Active Member
1,183
2011
254
0
Hey,

This is quick tut that basically show you how to make it so that when someone logs in ssh you get a detailed email with their ip, host, ect.

Lets get started :)

Step 1 :
Code:
cd /root

Step 2 :
Code:
pico .bashrc

Step 3 :
Scroll to the end of the file and add this.
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

Replace YourserverName with the name of your actual server
Replace you@yourdomain.com with your actual email address.

Step 4 :
Code:
Crtl + X  then Y


And their you go. All done :). To test log out of ssh and re-log back in. You should receive an email.
 
5 comments
Status
Not open for further replies.
Back
Top