I wonder if this should be more part of the login process rather than relying on dot files. E.g., a pam module, though that's not really the purpose of pam.
I would do this...assuming /etc/profile is sourced by all shells, which I am not 100% certain:
I checked my .profile and it's including my .bashrc (if it exists)
If you don't use bash, put it in .profile instead... does the same thing (not tested)
Check out this method which uses PAM's pam_exec option along with a pretty simple shell script. Using PAM is more effective, since you don't have to worry about different types of shell sessions and which config files are included in those sessions.
Comments
Do you use CSF firewall? Or Denyhost or fail2ban? They all have this features builtin.
http://askubuntu.com/questions/179889/how-do-i-set-up-an-email-alert-when-a-ssh-login-is-successful
Derp!
Google.com
@HalfEatenPie No!
@blergh_ Thanks but i googled already ;D
Is it like a bash script to send email for every login?
How about modifying the .bashrc?
@Neo
If you had you wouldn't be here asking questions now would you?
Does this apply to Dash as well? Been playing with that for a while now.
Last time I try it, it can work. But I forgot the little code
I wouldnt' do this, because it depends on bash:
http://www.lowendguide.com/email/email-notification-when-someone-logs-in-via-ssh/
I would do this...assuming /etc/profile is sourced by all shells, which I am not 100% certain:
http://www.atrixnet.com/send-an-email-when-someone-logs-in/
I wonder if this should be more part of the login process rather than relying on dot files. E.g., a pam module, though that's not really the purpose of pam.
https://github.com/udienz/ssh-checker
I checked my .profile and it's including my .bashrc (if it exists)
If you don't use bash, put it in .profile instead... does the same thing (not tested)
Add this to
Debian: /etc/bash.rc
CentOS: /etc/bash.bashrc
I ask here and i googled at the same time so, i hoped someone would post a script with good experinces so i can save some time ;P
Check out this method which uses PAM's pam_exec option along with a pretty simple shell script. Using PAM is more effective, since you don't have to worry about different types of shell sessions and which config files are included in those sessions.