- 04
- Sat
Linux – if anyone logs in notify SSH
Put the following in /etc/profile: The script /etc/profile is executed at every login (for bash shell users). 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 aFrom:youradd@email.com fi If you have issues delivering mail to a GMAIL inbox, […]