71. How do I make all users local administrators on macOS?
Local administrator to all users
This method has been tested in macOS 10.13.
Create a file /usr/local/sbin/makelocalusersadmin.sh with this content:
#!/bin/bash # List all users dscl . list /Users | grep -v '^_.*\|daemon\|root\|nobody\|administrator' | while read localUser do # For each user, add local users to the computers local admin group dseditgroup -o edit -a $localUser -t user admin done
Make it executable:
# chmod +x /usr/local/sbin/makelocalusersadmin.sh
Create a LauchDaemon with the name /Library/LaunchDaemons/se.uu.makelocalusersadmin.plist with this content:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>se.uu.makelocalusersadmin</string> <key>Program</key> <string>/usr/local/sbin/makelocalusersadmin.sh</string> <key>RunAtLoad</key> <true/> </dict> </plist>
Give all users sudo privileges
To get all users sudo access without also getting local computer administrator access then add the following to the file /etc/sudoers.d/make.all.users.root
ALL ALL=(ALL) ALL