Sshrc: Difference between revisions
Jump to navigation
Jump to search
(Created page with "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...") |
No edit summary |
||
Line 8: | Line 8: | ||
NOW=$( date '+%F_%H:%M:%S' ) | NOW=$( date '+%F_%H:%M:%S' ) | ||
Country=`curl -s https://ipapi.co/$ip/country/` > /dev/null | Country=`curl -s https://ipapi.co/$ip/country/` > /dev/null | ||
echo " | echo " | ||
UTC Date/Time: $NOW | UTC Date/Time: $NOW |
Revision as of 18:31, 28 October 2021
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" mail.server.com