Last active
May 5, 2016 20:42
-
-
Save fduran/1870474 to your computer and use it in GitHub Desktop.
Linux get email for SSH Logins
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# get an email every time a user logs in through ssh | |
# www.fduran.com | |
# add in /etc/profile | |
echo "`whoami` logged in at `date` from `echo $SSH_CLIENT`" | mail -s "`hostname` login" [email protected] & | |
# note this is not fool-proof. For example the user can run remotely a command thru ssh without logging in |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment