Dear Apple, I love you, but sometimes you drive me up the wall.
I've been playing around with a little project to set up sandbox drupal sites on a mac mini (more details on that later) ... that's easy stuff, but the annoying part is: I'd like to share directories via Samba which needs system accounts. The trick is, I want to add all of this via a simple little shell script. No problem right? Simple one line call to useradd... right?! Noooooooooo. Not in OS X. No, in OS X this is how you add user accounts from the commandline (which, of course, is under "Porting unix/linux applications"):
# dscl / -create /Users/portingunix # dscl / -create /Users/portingunix UserShell /bin/bash # dscl / -create /Users/portingunix RealName "Porting Unix # dscl / -create /Users/portingunix UniqueID 503 # dscl / -create /Users/portingunix PrimaryGroupID 1000 # dscl / -create /Users/portingunix NFSHomeDirectory /Local/Users/portingunix # passwd portingunix
I dunno... I think that's just annoying. Perhaps NetInfo has some beauty that I'm just don't understand, but, couldn't Apple at least ship with some standard useradd wrappers or something?
Welcome to 1988
At least in NextStep 3.x there was a GUI around netinfo.
The problem with netinfo is it predates all this LDAP stuff. nidump/niload used to be a way to work with it in a fairly unixish way but it looks like they broke that in OSX (password crypts are hidden).
Ian
ya it totally feels a bit arcane
not to mention needlessly verbose. and capitals?! omgwtf. i'd just like a simple, single line that works like I'm used to on every other platform... is that so wrong?
*cough*linux*
I know how much everyone loves Apple, but little things like this remind me how frustrating it is that close only counts in horseshoes, hand grenades and nuclear warfare...
close doesn't even count in
close doesn't even count in horseshoes or handgrenades - relatively speaking.... ah the dogs of war. Apple still makes the best stuff even if they only get close. If they only made dog food....
NetInfo is gone, replaced by
NetInfo is gone, replaced by the much better, standards-compliant OpenDirectory. This explains the "ds" (Directory Services) part of the "dscl" command, which replaces "nicl". The NetInfo Manager utility (present in Mac OS X up to 10.4) is also gone.
I'd appreciate it if someone woulld write a GUI wrapper around dscl (or utilizing the DS frameworks) sometime soon, but I will cobble one together before waiting *too* long. I'll be sure to replicate "adduser"-type scripts in it, too.
WorkGroup Manager
If you like, you can get a copy of WorkGroup Manager from a OS X Server machine ( I used one from a Leopard Pre-release) Simply copy the application to your local machine and run it, in the address field put localhost and then use the root username and password to log in. Once logged in you may have to change the directory you are looking at. You can change directories by going to the section just below the main Toolbar, it will have something like "Viewing directory ...... or Authenticated as root.... etc.. simply click on the drop down next to the tiny globe and choose Local, there.. you are now working with the ds database for that machine.. If you can only see the users you have added then you need to set the bit to view everything... Viewing everything is done by going to the main title bar and clicking on "WorkGroup Manager---> Preferences and ticking the box labeled "Show All Records" tab and Inspector. There, now you have access to everything..
Enjoy..
Steve I
Post new comment