makeuser

April 29, 2008

The inability to create user accounts from the command line is something that every Mac SA runs into at some point. Then we write our own scripts (here’s mine, here’s dre’s, for example).

But then today I discovered this:

zulu-30:~ admin$ /Library/Receipts/RemoteDesktopClient.pkg/Contents/Resources/makeuser 
ERROR: You must be root to run this tool.
ERROR: --longname not provided.
ERROR: Flag --shortname not provided.

makeuser -r "<volume path>" [ -0  -v -h ] {other options}

General Options:
----------------
-h | --help                    : Print command help.
-v | --verbose                 : Verbose output.

Required Account Settings Options:
----------------------------------
-n | --longname       "<string>" : User long name.
-s | --shortname      "<string>" : User short name.

Optional Account Settings Options:
----------------------------------
-l | --loginpic      "<file>"   : Choose login picture.
-c | --cryptpassword "<string>" : Cryt password for this user.

The weird thing is there’s different versions of this tool on the same OS X versions. The previous one was run on 10.4.11, as is the following:

flipbook:~ filipp$ /Library/Receipts/RemoteDesktopClient.pkg/Contents/Resources/makeuser
makeuser - scripted user creation under Mac OS X 10.2 or later
Usage:   makeuser -user <user> -realname <realname> [ -password <shadowpass> | -cryptpass <cryptpass> ] [<opts>]
....

10.5 behaves like the latter. Notice that this is all indeed inside the receipt package. :) While makeuser is far from being as nice as dre’s adduser, most of the time, it’s good enough.