Add successful login script

This commit is contained in:
Alice Gaudon 2022-06-05 11:20:56 +02:00
parent 1f0f73bd4c
commit 695dd52dc8
2 changed files with 8 additions and 3 deletions

View File

@ -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

5
notify-login.sh Executable file
View File

@ -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