In case if you want to send an warning email to user or admin once the user successfully logged in through SSH, the script below can be added to “/etc/profile”.
This file is loaded on users login.
#Added by SaEeD #Send an email if SSH login was successful 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 "WARNING!!! - successful SSH Login" saeed@hexor.ir fi
Hope this helps, good luck 🙂
— Saeed
BTC: 1G1myr8rYv7SgyYtyWXLu3WLSPNaHCGGcd