SSH login alert via email

SSH login alert via email

bash and script on Linux

 

Step 1: Login SSH to server and add these lines to .bashrc in home directory

echo “User Login Alert! `whoami` logged into `hostname` on `date`” |mail -s”User Login Alert! `whoami` logged into `hostname` on `date`” khoa@ithelpblog.com

 

Step 2: After that, you can try to ssh to that server agian, and check your email

 

That’s all. Thanks for using ithelpblog.com

Leave a reply

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>