From 51de8747238aa1279dac8290f686573c43a72212 Mon Sep 17 00:00:00 2001 From: Pierre Gode Date: Fri, 5 Apr 2019 08:07:59 +0200 Subject: [PATCH] Fixed checks --- ADconnection.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ADconnection.sh b/ADconnection.sh index 4eac64c..e98775a 100755 --- a/ADconnection.sh +++ b/ADconnection.sh @@ -779,7 +779,7 @@ echo Checking sudoers file.. "${INTRO_TEXT}OK${END}" else echo checking sudoers file.. "${RED_TEXT}FAIL not configured${END}" fi -grouPs=$(grep -i "$myhost" /etc/sudoers.d/sudoers | cut -d '%' -f2 | cut -d '=' -f1 | sed -e 's/\//g') +grouPs=$(grep -i "$myhost" /etc/sudoers.d/sudoers | cut -d '%' -f2 | awk '{print $1}' | head -1) if [ "$grouPs" = "$myhost""sudoers" ] then echo "Checking sudoers users.. ${INTRO_TEXT}OK${END}" @@ -1179,7 +1179,7 @@ fi if [ -f /etc/sudoers.d/sudoers ] < /dev/null > /dev/null 2>&1 then echo Checking sudoers file.. "${INTRO_TEXT}OK${END}" -grouPs=$(grep -i "$myhost" /etc/sudoers.d/sudoers | cut -d '%' -f2 | cut -d '=' -f1 | sed -e 's/\//g' | sed -e 's/sudoers//g' ) +grouPs=$(grep -i "$myhost" /etc/sudoers.d/sudoers | cut -d '%' -f2 | awk '{print $1}' | head -1 | sed -e 's/sudoers//g' ) if [ "$grouPs" = "$myhost" ] then echo Checking sudoers users.. "${INTRO_TEXT}OK${END}" @@ -1249,7 +1249,7 @@ else if [ -f /etc/sudoers.d/sudoers ] < /dev/null > /dev/null 2>&1 then echo "Checking sudoers file.. OK" -grouPs1=$(grep -i "$myhost" /etc/sudoers.d/sudoers | cut -d '%' -f2 | cut -d '=' -f1 | sed -e 's/\//g' | head -1) +grouPs1=$(grep -i "$myhost" /etc/sudoers.d/sudoers | cut -d '%' -f2 | awk '{print $1}' | head -1 | head -1) if [ "$grouPs1" = "$myhost""sudoers" ] then echo "Checking sudoers user groups.. OK"