Adding a new user with the CLI on OS 10.6

Posted by Dark Training on May 9, 2011 tags: | mac

Recently I came across a laptop in the field that needed to be worked on but the only user on the machine, and thus the local admin, was not on site to login and allow us to work.

Like many things there are a few ways that you can get past this, for 10.6 the easiest way is to boot into single user mode:

Reboot, then Press Command + S

Then mount the disc in writable mode:

# mount -uw / 

Then just move the following file which is used by the machine to figure out if the first run setup has been completed:

# mv /var/db/.AppleSetupDone /var/db/.AppleSetupDone.old

Then reboot and you should be given the normal first run screen that will allow you to create an account which is also an administrator account.

Option 2

The other way to do this is using the dscl command. However in truth, this command seems to be hit or miss (replace ... with the desired name).

#dscl / -create /Users/....
# password ...