#94 Adding a User to a Mac OS X System

Earlier in the book, in Script #44, you saw the basic steps involved in adding a new user to a typical Unix or Linux system. The Mac OS X version is fundamentally quite similar. In essence, you prompt for an account name and login shell, append the appropriate information to the /etc/passwd and /etc/shadow files, create the new user's home directory, and set an initial password of some sort. With Mac OS X it's not quite this simple, because appending information to /etc/passwd will not create a new Aqua account. Instead, the information must be injected into the NetInfo system using the niutil command.

The Code

 #!/bin/sh # addmacuser - Adds a new user to the system, including building the # home ...

Get Wicked Cool Shell Scripts now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.