GithubHelp home page GithubHelp logo

Comments (3)

jlevitsk avatar jlevitsk commented on August 11, 2024

This line causes the removeAdmin.sh to terminate and the actions after it don't happen which include the log collection and the removal of the LaunchDaemon. Just move this line to be 2 lines lower than it is so the removal happens and add a line to remove the removeAdmin.sh file too. That's what I found anyway.

launchctl unload /Library/LaunchDaemons/removeAdmin.plist

from makemeanadmin.

jcejka11 avatar jcejka11 commented on August 11, 2024

On 12.x putting this after the rm -rf /Library/LaunchDaemons/removeAdmin.plist will prevent the launchdaemon from unloading. file or folder not found error.

from makemeanadmin.

cstout-jamf avatar cstout-jamf commented on August 11, 2024

Replacing the end of the MakeMeAnAdmin script (the part that creates the local removal script) with what is below has helped ensure logs are properly created and the files used for the privilege changes are removed when the script finishes, including the script itself:

if [[ -f /private/var/userToRemove/user ]]; then
	userToRemove=$(cat /private/var/userToRemove/user)
	echo "Removing $userToRemove's admin privileges"
	/usr/sbin/dseditgroup -o edit -d $userToRemove -t user admin
	rm -f /private/var/userToRemove/user
	rm /Library/LaunchDaemons/removeAdmin.plist
	log collect --last 10m --output /private/var/userToRemove/$userToRemove.logarchive
	rm -- "$0"
	launchctl unload /Library/LaunchDaemons/removeAdmin.plist
fi
EOF

from makemeanadmin.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.