I want to be able to create new users from the command line when I am logged in as an administrator. Specifically, I am looking for an equivalent of the
adduser command on Linux.
I think you're looking for the dscl command. Niutil sounds like NetInfo which is deprecated in OS X in favor of Open Directory aka LDAP.
Dscl, or Directory Services Command Line, can be used to edit Open Directory for both a local or remote user data store. It can be done with sudo commands but it's easier to use as root.
Here's a short and highly inadequate tutorial: In the terminal, sudo -s to switch your user to root. To create a functional user account named dscl2, you need to do the following:
The UUID is typically around 501 or larger. 501 is the default UID for the first account created. UIDs less than 500 don't show up in the Accounts pane by default. Choose whatever number you want, but make sure it is unique on the local system. Don't overwrite an existing UID or you will have big problems.
Dscl has an interactive mode as well that works a little differently. Enter just "dscl" at the prompt to enter interactive mode.
If you're in Interactive mode, type ls to list which directories are available. You should see BSD, LDAP and Local. You navigate through the directories with cd. See your friend the man page for more info.
There is a good script available at http://wiki.freegeek.org/index.php/Mac_OSX_adduser_script However it has several typos and sometimes is not flexible enough, so here is my modified version of it with some improvements: