Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

fight.stupidity

macrumors newbie
Original poster
Jan 11, 2011
1
0
Hi there,

Hope this isn't too complex of a script to try to make but this is what I'm trying to do.

Create a new group and add local users that aren't admin to the group.

So let's say the new group is 'cats' and 'dog' is the only admin on the machine. Let's say most machines only have one or two users but they're going to be different on each machine.


Since the name of the non-admin username(s) on each machine is a variable, I'm thinking the best way to add users to the 'cats' group is to go by Group ID but the only groups I know of are Wheel, Staff and Admin. All users on the Mac are a member of Staff by default so is there an identifier that represents a non-admin user which I can use to add them to the 'cats' group?

Hope that makes sense.

Here's what I have so far but it isn't much and I'll be honest, I can't figure from the dseditgroup man pages to do this.

"!/bin/bash
sudo dseditgroup -o create -n . cats
dscl -u apl . -append /Groups/cats GroupMembership <username/groupID>

Should I use dscl to append the group or continue to use dseditgroup?

Is this even a do-able thing? I've been trying to figure it out but bash scripting is new to me but something I'd like to learn. Seems like a very powerful way of getting a lot of repetitive tasks done.

Thanks in advance!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.