diff --git a/mail.sh b/mail.sh index b797447..a189c00 100755 --- a/mail.sh +++ b/mail.sh @@ -1,8 +1,8 @@ #!/bin/bash -MAILTO=$(cat "$HOME/.admin_mail") +MAILTO=$(cat "/root/.admin_mail") -if [ -f "$HOME/.host_mail" ]; then - MAILFROM=$(cat "$HOME/.host_mail") +if [ -f "/root/.host_mail" ]; then + MAILFROM=$(cat "/root/.host_mail") fi SUBJECT=$1 diff --git a/notify-login.sh b/notify-login.sh new file mode 100755 index 0000000..3a27549 --- /dev/null +++ b/notify-login.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +if [ "$PAM_TYPE" != "close_session" ]; then + echo -e "$PAM_USER has successfully logged in on $(hostname) from $PAM_RHOST" | $(dirname $0)/mail.sh "$(hostname) SSH Login: $PAM_USER" +fi