Skip to content

Instantly share code, notes, and snippets.

@fduran
Last active May 5, 2016 20:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fduran/1870474 to your computer and use it in GitHub Desktop.
Save fduran/1870474 to your computer and use it in GitHub Desktop.
Linux get email for SSH Logins
# 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" youremail@example.com &
# 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