AFP548

OS X Server Add User Script

Quick script that will allow you to add a user from the Command Line

Get the script from the Downloads section.This script leverages the dsimporexport command to create an import file and then import it to either the NetInfo or the LDAP domain on your server.

To create a user with a shortname of “joel”, a long name of “Joel Rennich” a password of “test”, and a home on “www.afp548.com” you’d use this:


adduser -s joel -n "Joel Rennich" -h www.afp548.com -p test

That will generate a dsimportexport file at /tmp/importfile.txt that you can then load into Workgroup Manager.

To do this all at once you can use this:


adduser -s joel -n "Joel Rennich" -h www.afp548.com -p test -L -A adminuser

Which will prompt for your admin password and then import the dsimportexport file into the LDAP database on the server.

The script is pretty heavily commented, so take a look at it for in depth usage information. Keep in mind that this script assumes that Workgroup Manager is in /Applications/Server. If it isn’t adjust the script as necessary.

Exit mobile version