_mbsetupuser and Giving local admin rights

Bhughes
Contributor

All - using the following script we are giving the user local admin rights. It is set for Login, once per user per computer.

#!/bin/bash

loggedInUser=$(stat -f '%Su' /dev/console)
evaluate=$( /usr/sbin/dseditgroup -o checkmember -m $loggedInUser admin )

echo $evaluate

case $evaluate in
    *yes* ) echo User is already an admin on this mac;;
    *no* ) /usr/sbin/dseditgroup -o edit -a $loggedInUser -t user admin;;
    * ) echo Something went wrong;;
esac

We're seeing an issue, intermittently, where the user isnt getting the rights. In the logs, it looks like its triggered when _mbsetupuser is logged in, and not the actual user we are using... What is _mbsetupuser, and does anyone know why this might be happening?

Thanks!
Ben

1 ACCEPTED SOLUTION

Bhughes
Contributor

Perfect! Thanks @davidacland That worked!

View solution in original post

2 REPLIES 2

davidacland
Honored Contributor II
Honored Contributor II

That user is part of the upgrade process for 10.11.x. If you're using once per computer per user, it should run again when the actual user logs in, so you just need to add an if statement to exit if the _mbsetupuser is logged in.

Bhughes
Contributor

Perfect! Thanks @davidacland That worked!