Select Page

Within:
etc/profile

Add:

connip=($SSH_CLIENT)
echo “${connip[0]}”

if [ ${connip[0]} == 12.34.56.78 ]; then
    echo “User logged in from internal IP Address:” ${connip[0]} | mailx -s “Login alert” [email protected]
else
    echo “User logged in from internal IP Address :” ${connip[0]} | mailx -s “Login alert – External IP” [email protected]
fi

%d bloggers like this: