From 2165633605afa00bf976669078cf833431dfbb69 Mon Sep 17 00:00:00 2001 From: LemonTree <84917241+Astorias96@users.noreply.github.com> Date: Sat, 5 Feb 2022 21:46:08 +0100 Subject: [PATCH 1/2] Granting access bug - jamf/MakeMeAnAdmin issue#9 https://github.com/jamf/MakeMeAnAdmin/issues/9 --- MakeMeAnAdmin.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MakeMeAnAdmin.sh b/MakeMeAnAdmin.sh index 5c2a54f..76b8615 100644 --- a/MakeMeAnAdmin.sh +++ b/MakeMeAnAdmin.sh @@ -65,6 +65,7 @@ fi ################################## /usr/sbin/dseditgroup -o edit -a $currentUser -t user admin +echo "$currentUser ALL=(ALL) ALL" >> /etc/sudoers.d/sudoers ######################################## # write a script for the launch daemon # @@ -76,6 +77,7 @@ cat << 'EOF' > /Library/Application\ Support/JAMF/removeAdminRights.sh if [[ -f /private/var/userToRemove/user ]]; then userToRemove=$(cat /private/var/userToRemove/user) echo "Removing $userToRemove's admin privileges" + rm /etc/sudoers.d/sudoers /usr/sbin/dseditgroup -o edit -d $userToRemove -t user admin rm -f /private/var/userToRemove/user launchctl unload /Library/LaunchDaemons/removeAdmin.plist From 80920c0c675e113d8cef734572d4128e92a69ea5 Mon Sep 17 00:00:00 2001 From: LemonTree <84917241+Astorias96@users.noreply.github.com> Date: Sat, 5 Feb 2022 21:47:40 +0100 Subject: [PATCH 2/2] Update MakeMeAnAdmin.sh --- MakeMeAnAdmin.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MakeMeAnAdmin.sh b/MakeMeAnAdmin.sh index 76b8615..4910be9 100644 --- a/MakeMeAnAdmin.sh +++ b/MakeMeAnAdmin.sh @@ -77,8 +77,8 @@ cat << 'EOF' > /Library/Application\ Support/JAMF/removeAdminRights.sh if [[ -f /private/var/userToRemove/user ]]; then userToRemove=$(cat /private/var/userToRemove/user) echo "Removing $userToRemove's admin privileges" - rm /etc/sudoers.d/sudoers /usr/sbin/dseditgroup -o edit -d $userToRemove -t user admin + rm /etc/sudoers.d/sudoers rm -f /private/var/userToRemove/user launchctl unload /Library/LaunchDaemons/removeAdmin.plist rm /Library/LaunchDaemons/removeAdmin.plist