michael sun

Q: how to create a user on 30 macs with different usernames via ard

Hi, i am new to apple remote desktop.  I am distributing 30 macs to 30 users. I need to created a user on each mac with the name of the user as username. For example, the user is Bill Gates, the username would be bgates, and so on. I have googled for days, but have not found any solutions. What I got is how to create a user with same username on multiple macs via unix command.

Your advice will be much appreciated.

Thanks

Michael

Posted on May 7, 2016 3:56 AM

Close

Q: how to create a user on 30 macs with different usernames via ard

  • All replies
  • Helpful answers

  • by MrHoffman,

    MrHoffman MrHoffman May 8, 2016 6:45 AM in response to michael sun
    Level 6 (15,612 points)
    Mac OS X
    May 8, 2016 6:45 AM in response to michael sun

    I'm not entirely sure what you're asking for.

     

    There's a default for the short name derived from the long name — that's usually been the specified long name, edited for reserved characters and converted to lowercase — but there's no particular requirement what short name is associated with any long name.  With the default processing for your example, the short name would be billgates.   Are you looking to learn how to convert strings in bash?  (Because that's not ARD.)

     

    Usual approach is to set up Open Directory or Active Directory (LDAP) and use single-sign-on across all the systems by binding the clients to the directory server, but if these are standalone boxes...  Then you'll be creating users from the command line, the command is dscl and the basic sequence hasn't changed in a while...   But there's no integrated mechanism to create different users on different boxes.

     

    If you're writing a script to do this (as would be typical), then you're going to be reading a list of users (somehow) from a file (probably with both the long name and the short name and other user-specific data) and then pushing out the unique commands, or pushing out a unique script and invoking that.

     

    You're probably also headed toward createUserPkg and Munki and related tools.  The archives of the MacEnterprise mailing list will probably also be of interest, as this question and various follow-on and related questions — as well as Munki and Reposado and other tools — have been discussed there.

  • by michael sun,

    michael sun michael sun May 8, 2016 7:48 AM in response to MrHoffman
    Level 1 (4 points)
    Servers Enterprise
    May 8, 2016 7:48 AM in response to MrHoffman

    Hi MrHoffman, thanks for your help and reply. I mean is there commands that enable me to create a user account on 30 macs, the username should be different on each mac.

     

    Regards,

  • by MrHoffman,

    MrHoffman MrHoffman May 8, 2016 9:04 AM in response to michael sun
    Level 6 (15,612 points)
    Mac OS X
    May 8, 2016 9:04 AM in response to michael sun

    michael sun wrote:

     

    I mean is there commands that enable me to create a user account on 30 macs, the username should be different on each mac.

     

    There is no pre-existing command to create 30 mostly- or completely-different accounts, with different user and password settings.

     

    That involves acquiring user account input data (from somewhere, in some particular format), and maybe also involves one or more of the add-on tools mentioned in my previous reply.

  • by Antonio Rocco,

    Antonio Rocco Antonio Rocco May 9, 2016 4:34 AM in response to michael sun
    Level 6 (10,586 points)
    Desktops
    May 9, 2016 4:34 AM in response to michael sun

    "I need to create a user on each mac with the name of the user as the username . . ."

     

    As Mr Hoffman has already pointed out you use dscl if you want to use the command-line.

     

    There are problems I see with using this method. First one is the question of passwords. You could, for example, assign the same for each user and ask them to change it after they've logged in. They can change it in the Users & Groups preference pane. Or you could assign a different one for each user and simply tell them what it is. Another problem is whether you're going to give them administrative access? If you are then why bother doing it this way? Assuming the macs are still in their boxes and have never been switched on, simply hand them out and let them do it themselves. That way you're not involved and you don't need to know potentially sensitive information.

     

    If they're not going to be given administrative access what follows may help you? Before I start, some questions:

     

    On the 30 macs have you switched them on first and created the default admin account? You have to do this anyway otherwise you can't enable Remote Management.

     

    If you've done this already make sure you've enabled all the options. Depressing the option/alt key when enabling Remote Management in the Sharing Preferences pane will do this for you.

     

    Have you given each mac a unique name? You do this in the Sharing Preferences Pane. Something like Mac1, Mac2 etc.

     

    If you've done this already you'll presumably have decided which one is assigned to which user?

     

    If you've done all of the above then in the list part of ARD you should see the unique names of each mac. Select the first one and assuming it is the mac you're going to hand out to Andy Brown - as an example - type into the Send UNIX Command window (or you could copy and paste) the following:

     

    dscl . -create /Users/abrown UniqueID 502

    dscl . -create /Users/abrown UserShell /bin/bash

    dscl . -create /Users/abrown RealName "Andy Brown"

    dscl . -passwd /Users/abrown password

    dscl . -create /Users/abrown PrimaryGroupID 20

    dscl . -create /Users/abrown NFSHomeDirectory /Local/Users/abrown

     

    Send the commands as root.

     

    Move onto the next mac and assuming the next user's name is Barry Charles (as an example) change abrown and Andy Brown shown above into bcharles and Barry Charles. Keep doing this in turn until you've finished. Hand over the macs to each user in turn when you're done.

     

    So what are the commands above actually doing?

     

    First command creates the user in the local domain in the /Users category

    Next one allows them to log in on that mac

    Next creates their full name

    Next one sets their password

    Next one makes them a standard (non-admin) user

    Last one creates and sets their home folder.

     

    A word of caution. Before you do all 30, test on one mac first and once you're happy it works move onto the rest.

     

    Finally, there are other (potentially easier/better?) ways of doing what you want to do. If these macs are being placed into an Enterprise Environment such as Microsoft's Active Directory or, possibly, Apple's Open Directory, then simply creating the users on the directory server and binding/joining the macs to the network/domain will do the same without the need for any of the above.

     

    Hopefully this may help in getting you to where you want to be?

    Tony