Advertisement
fduran

Linux get email for SSH Logins

Apr 21st, 2011
1,055
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.31 KB | None | 0 0
  1. # get an email every time a user logs in through ssh
  2. # www.fduran.com
  3.  
  4. # add in /etc/profile
  5. echo "`whoami` logged in at `date` from `echo $SSH_CLIENT`" | mail -s "`hostname` login" youremail@example.com
  6.  
  7. # note this is not fool-proof. For example the user can run remotely a command thru ssh without logging in
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement