Link to home
Start Free TrialLog in
Avatar of masaiming
masaimingFlag for United States of America

asked on

Create users from .csv - Mac OS X

I have a bunch of employees that I need to create accounts for.  I am very inexperienced with scripting.  

I have their user account, first name, last name, email address in columns.  This is saved as a .csv file.  

If someone could show me a template or example of where I can get this information, I would greatly appreciate it.  Thank you

Avatar of masaiming
masaiming
Flag of United States of America image

ASKER

This is using Open Directory on Mac OS X Lion.  
Avatar of farzanj
All you need is a simple shell script.  You need a loop that parses through the file and creates users.

Here is how you create users in Mac OS X
http://serverfault.com/questions/20702/how-do-i-create-user-accounts-from-the-terminal-in-mac-os-x-10-5


If you want to get it parsed, provide a sample csv file.
How do I have it generate a new UID every time it creates a new account?

So I just want to create their username, real name, login shell, unique id, home directory

I would create a .csv file with 5 columns with that information.

I running that single command is fine, but how do I loop pulling that information off the .csv file?
ASKER CERTIFIED SOLUTION
Avatar of farzanj
farzanj
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You can just import the users using Workgroup Manager. Server>import.  It will automatically create the accounts and give you mapping options for many other attributes. It will create the UID for you for each account.