Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
17 lines (12 sloc) 419 Bytes
#!/bin/sh
# Change these two lines:
sender="name@domain.com"
recepient="name@domain.com"
logininfo="$(tail /var/log/auth.log | grep -i 'accepted password')"
if [ "$PAM_TYPE" != "close_session" ]; then
host="`hostname`"
subject="New SSH Login on $host"
# Message sends last registrated login
message="$logininfo"
echo "$message" | mailx -r "$sender" -s "$subject" "$recepient"
fi
You can’t perform that action at this time.