isRootLoggedIn=`who |grep root |awk '{print $1}'`
if [ "$isRootLoggedIn" = "root" ]; then
echo "ROOT logged into `hostname -s` on `date` was this expected?" |mail -s "ROOT logged in" noc@company.com
fi
linux/rootloginwarning.txt · Last modified: 12/01/2021 13:19 by andrew