Tutorials SSH Login Email Alerts!

Marks-Man

Administrator
Joined: Mar 15, 2021
Messages: 63
Resources: 14
Points: 18
Reaction score: 28
Put the following in /etc/profile:
if [ -n "$SSH_CLIENT" ]; then
TEXT="$(date): ssh login to ${USER}@$(hostname -f)"
TEXT="$TEXT from $(echo $SSH_CLIENT|awk '{print $1}')"
echo $TEXT|mail -s "ssh login" you@your.domain
fi
 
  • Tags
    erros security ssh
  • Top