diff --git a/ADconnection.sh b/ADconnection.sh index 67d5d1e..6b600ff 100644 --- a/ADconnection.sh +++ b/ADconnection.sh @@ -129,11 +129,17 @@ sudo touch /etc/ssh/login.group.allowed sudo echo "administrator" | sudo tee -a /etc/ssh/login.group.allowed sudo echo "$NetBios"'\'"$myhost""sudoers" | sudo tee -a /etc/ssh/login.group.allowed sudo echo "$NetBios"'\'"domain^admins" | sudo tee -a /etc/ssh/login.group.allowed +sudoersfile=$(cat /etc/sudoers.d/sudoes | grep $myhost) +if [ "$sudoesfile" -eq "$myhost" ] +then +echo "Sudoersfile seems already to be modified.. skipping...." +else sudo echo "administrator ALL=(ALL:ALL) ALL" | sudo tee -a /etc/sudoers.d/sudoers sudo echo "%$myhost""sudoers ALL=(ALL:ALL) ALL" | sudo tee -a /etc/sudoers.d/sudoers sudo echo "%domain\ users ALL=(ALL:ALL) ALL" | sudo tee -a /etc/sudoers.d/sudoers sudo echo "%DOMAIN\ admins ALL=(ALL) ALL" | sudo tee -a /etc/sudoers.d/domain_admins #sudo realm permit --groups "$myhost""sudoers" +fi therealm=$(realm discover $DOMAIN | grep -i configured: | cut -d ':' -f2 | sed -e 's/^[[:space:]]*//') if [ $therealm = no ] then