Sshrc
E-Mail Alert on SSH Login Event
- /etc/ssh/sshrc
#!/bin/bash #email on ssh login ip=`echo $SSH_CONNECTION | cut -d " " -f 1` Hostname=`hostname` NOW=$( date '+%F_%H:%M:%S' ) Country=`curl -s https://ipapi.co/$ip/country/` > /dev/null echo " UTC Date/Time: $NOW IP Address: $ip Country: $Country Target Hostname: $Hostname User: $USER " | mail -s "SSH Login Alert From: $ip" user@domain.com