I've a system setup where an email is sent on a user login (line from .bashrc):
printf "user details, ip etc" | mail -s "[LOGIN NOTICE] `hostname` - `whoami`" <admin>@<domain>.co.uk
This works, I'm looking to make it a little smarter. it will email on any login, even on a SCP transfer. Can anyone suggest how I can detect and exclude SCP or TTY etc.
Thanks in advance