Mail alert when someone logs into your SSH

d4rkl0rd

Active Member
Feb 23, 2004
39
0
156
India
vi /root/.bash_profile

echo 'ALERT - Root Shell Access (YourserverName) on:' `date` `who` | mail -s "Alert: Root Access from `who | cut -d"(" -f2 | cut -d")" -f1`" [email protected]

or

echo 'ALERT - Root Shell Access on:' `date` `who` | mail -s "Alert: Root Access from `who | awk '{print $6}'`" [email protected]

Make sure that the e-mail address you use is not hosted on the server

Andrew Arumaithambi :D
 
Last edited: