Linux send an email after login

It is a security concept that you know when a user (almost root user) loge in.

For this do like below

Add a shell script to send email

cd etc/ssh/

nano and add below code

You should change sender and recepient

After that we should change file permission
chmod a+w
and for testing sh
Please check your email (inbox and spam folder).

nano /etc/pam.d/sshd And add this line at the end of file (use Alt and / to go to the end)

session optional seteuid /path/to/

All thing is ready but be careful, Please use another terminal to connect to your server and do not close your current connection.

Leave a Reply

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

÷ 1 = 6