SSH Notifications via email

IP=”$(echo $SSH_CONNECTION | cut -d ” ” -f 1)”
HOSTNAME=$(hostname)
NOW=$(date +”%e %b %Y, %a %r”)

echo ‘Someone from ‘$IP’ logged into ‘$HOSTNAME’ on ‘$NOW’.’ | mail -s ‘SSH Login Notification’ YOUR_EMAIL_ADDRESS — -f FROM_EMAIL_ADDRESS

Was this post helpful?

Total Page Visits: 364 - Today Page Visits: 4