How To get Email Notifications For User Logins (SSH/SFTP)

http://www.tecmint.com/get-root-ssh-login-email-alerts-in-linux/
https://www.vultr.com/docs/enable-ssh-login-notification-on-linux

+ yum install mailx
+ cd /root
+ nano .bashrc

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’ email

admin has written 114 articles

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>