Not sure if this is possible. We are rolling out MacBooks to students and are making their account a standard user by default. If a student manages to make their account an administrator, is there a way to check that and change it back? Say they figure out what the JAMF admin account password is. I have one computer I know of where the student has changed their account type, and created a second admin account. Any options here aside from re-imaging?
Solved
Policy to Change Account Type?
Best answer by mm2270
Sure.
Use dseditgroup to make any accounts on the Mac outside of known local admin accounts your using into standard users.
See this snippet from something I worked on a while ago-
#!/bin/sh
## Demote admin users to standard
## Get list of users for demotion
/bin/echo "Building list of local user accounts for demotion"
userList=$( /usr/bin/dscl . -list /Users UniqueID | /usr/bin/awk '$2 >= 501 { print $1; }' | /usr/bin/grep -ve "admin|otheradmin|anotheradmin" )
## Remove admin privs from each user and add them into the _lpadmin group
for i in $userList; do
if [[ `/usr/sbin/dseditgroup -o checkmember -m $i admin | /usr/bin/awk '{ print $1 }'` = "yes" ]]; then
/bin/echo "User $i is currently an admin. Converting into Standard User"
/usr/sbin/dseditgroup -o edit -d $i -t user admin
/bin/echo "Adding $i into _lpadmin group"
/usr/sbin/dseditgroup -o edit -a $i -t user _lpadmin
else
echo "User $i is currently a Standard User. Leaving as is."
fi
done
In the above, you need to replace the reverse grep (grep -ve) with your local admin accounts between the quote marks. Place a pipe betwen each name if you have multiple ones. if you only have one, no need for "-ve", just use grep -v "youradminname"
Note that this only sees accounts above UID 500, so it safely ignores all the System level accounts.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
