Press "Enter" to skip to content

Root Login Email Alert

Pedro Adelino 0

Add this script to /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

Leave a Reply