3 ms·
If you want to send email on login, add in /etc/profile : echo "`whoami` logged in at `date` from `echo $SSH_CLIENT`" | mail -s "`hostname` login" youremail@ex
by lazyant 11y ago
If you want to send email on login, add in /etc/profile :
echo "`whoami` logged in at `date` from `echo $SSH_CLIENT`" | mail -s "`hostname` login" youremail@example.com
Note that people can still ssh execute remotely etc.
- mscman 11y agoYou'll definitely want to add a '&' at the end of that line so that you don't delay user logins if the network is down or mail barfs.
- lazyant 11y agoright, actually I do have a delay in a server with no mail where it fails :-)
- taylorhughes 11y agopam_exec seems to be a more robust solution to login notifications than /etc/profile http://blog.stalkr.net/2010/11/login-notifications-pamexec-scripting.html http://blog.stalkr.net/2010/11/login-notifications-pamexec-s...