Black Friday Deal: Web Hosting from Tsh 67,000/yr β€” 85% OFF + Free Domain!

Send Email Alert on SSH Access

Manage your hosting services with ease.

Send Email Alert on SSH Access

How to send an email alert on SSH access? Here we go

#nano ~/.bash_profile

and add this at the bottom of the page

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' your@domain.com
Please rate this article to help us improve our Knowledge Base.

0 0

Chat with us on WhatsApp