[How To] Create a User Account on a Remote Machine via SSH and the Command Line

Tarz

Registered
Being a lazy Mac Admin, I prefer not to have to visit users' machines in order to get relatively simple tasks done. For example, if I needed to setup a local account on someone's Mac so that someone else could use it, I wouldn't want to have to walk over to another building to do that. I also wouldn't want to have to even use Timbuktu to remote control the machine if it wasn't necessary, since I might accidentally remote in at the time someone's reading email or whatever. So figured out how to script the creation of a new account from the command line. Then I pushed that script out to the machines on the network. Now if I need to create a user account, all I need to do is SSH to the other machine and type a single command on the command line. After I fill in some information the script needs, the account is automagically created for me.

The script I used to do this is available here:
http://mikesalsbury.com/mambo/content/view/130/2/

The script will create administrator and non-administrator accounts, and will also setup the user's home directory (i.e., "/Users/<newuser>").

While I've tested this script on OS X 10.3 and it seems to work (I don't have 10.4 yet to confirm that it works with 10.4), your mileage may vary. As with any freebie, use at your own risk.
 
That script looks nice. Will try it out when i get home.
Do you know if there's a way around chosing a numerical UID in OS X and let the system use the next available UID?
 
Nice find. And yes, what mgruene asks for would be great - and more similar to what SysPrefs does if you add a user.
 
Back
Top