ssh login notifications ssh login notification ubuntu ssh login notification slack ssh connection notification ssh login email notification centos enable ssh login notification on linux ssh login telegram notification ssh login email notification linux ssh login notification

Hi guys today i am going to show how to enable email notification after logged into server via ssh

# nano ~/.bash_profile

insert the following lines:

IP="$(echo $SSH_CONNECTION | cut -d " " -f 1)"
NOW=$(date +"%e %b %Y, %a %r")

echo 'Someone from '$IP' logged into '$HOSTNAME' on '$NOW'.' | mail -s 'SSH Login Notification' YOUR_EMAIL_ADDRESS

* Please rename "YOUR_EMAIL_ADDRESS" with your mail address

# yum install mailx

thats all

Manusha Amal

Hi, I am Manusha. Currently working as Systems Engineer. I

Post A Comment:


දිරියක් වෙන්න අදහස් පෙළක් දාන්න