Last active
March 4, 2022 17:32
-
-
Save D4R4/1d1bfbb0dde320c229d6fcfcf0f74632 to your computer and use it in GitHub Desktop.
Send email on ssh sessions, useful to put in .bashrc, Requires sendemail package to be installed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UZR=`who | cut -d"(" -f2 | cut -d")" -f1` | |
if [ "$UZR" != "" ]; then | |
sendemail -f '[email protected]' -t '[email protected]' -s '10.10.10.10' -u "Alert: Root Access on `hostname` from $UZR" -m "at `date`" > /dev/null 2>&1 | |
sendemail -f '[email protected]' -t '[email protected]' -s '10.10.10.10' -u "Alert: Root Access on `hostname` from $UZR" -m "at `date`" > /dev/null 2>&1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment