Skip to main content

Before I'm inventing something that already exists... We'd like to create a self service item for our first line support which enables them to create a local user account on a device bij just one click.

@DeployAdam Why not a policy to create he admin account?



Or is this say, promoting users to admins?


This is to make a user (them self) a local admin, it does not ask which user, it just give access to any account that is logged in, and of course it does it from the Self Service app.



this is the link where I got it from: https://github.com/kitzy/makeAdminUser/blob/master/makeAdminUser.sh



so create the script in your JSS, than a policy to make it available in self service.



kudos to: John Kitzmiller.



!/bin/bash



NAME



makeAdminUser.sh



########################################################################################


# HISTORY



Version: 1.0



SUPPORT FOR THIS PROGRAM



# This program is distributed "as is" by John Kitzmiller. For more



information or support for this script, please visit kitzy.org.



- Created by John Kitzmiller



########################################################################################


Check to make sure $3 is set properly by the JSS, if not, set the current username manually



This is a workaround for D-005003 (resolved in 9.01)



if [ -z $3 ];
then
currentUser=stat -f '%Su' /dev/console
else
currentUser=$3
fi



Add the current user to the local admin group on the Mac



dseditgroup -o edit -a $currentUser -t user admin



if [ "$?" == "0" ];
then
echo "Successfully added $currentUser to admin group"
else
echo "ERROR: Unable to add $currentUser to admin group"
exit 1
fi



exit 0


Reply