Terminal command to change "Login Options"

Discussion in 'Mac Basics and Help' started by hawkinsd, Apr 6, 2016.

  1. hawkinsd macrumors newbie

    Joined:
    Apr 6, 2016
    #1
    Hello, just wondering if there is a command to run in terminal that would change the "login options" for "Display login window as" from "Name and password" to "list of users" on OS X 10.10.

    Regards
     
  2. Mr_Brightside_@ macrumors 68020

    Mr_Brightside_@

    Joined:
    Sep 23, 2005
    Location:
    The 6ix
    #2
    Just to clarify, you specifically want to use Terminal instead of system prefs?
     
  3. hawkinsd thread starter macrumors newbie

    Joined:
    Apr 6, 2016
    #3
    --- Post Merged, Apr 7, 2016 ---
    Ideally something I can apply via some form of a script through deploy studio i.e.

    Deploying a new image to 100 macs, 50 of them want the "Name and password" at login and 50 want "List users" so instead of holding two different image builds was wondering if these setting could be changed via a script / terminal that I could place in a deploy studio workflow to automate the changes.
     
  4. Weaselboy Moderator

    Weaselboy

    Staff Member

    Joined:
    Jan 23, 2005
    Location:
    California
    #4
    Take a look at the dscl command here. It can do some manipulation of user accounts and might be able to do what you want.
     
  5. chrfr macrumors 603

    Joined:
    Jul 11, 2009
    #5
    This can be managed with a configuration profile. That's probably the easiest way to handle it. The easiest way to do that is to get a copy of OS X Server and set up the profile manager. It's not necessary to use profile manager to enroll your computers, but you can. Some people would say that Profile Manager isn't a reliable way to manage systems. If you opt not to enroll computers, you can just download the profile then install that profile into your client computers.
    http://www.amsys.co.uk/2015/02/creating-config-profiles-instead-first-boot-script/
    --- Post Merged, Apr 7, 2016 ---
    dscl doesn't handle loginwindow preferences.
     
  6. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #6
    A scripted change will need to run as root. Do scripts in Deploy Studio always run as root?


    The setting appears to be in this file:
    /Library/Preferences/com.apple.loginwindow.plist​

    Two command-line tools that can alter plist files are:
    defaults
    PlistBuddy​

    See the man page of each for details.

    If more details are needed, I can post sample commands to run, and actions to perform in System Preferences.
     
  7. chrfr macrumors 603

    Joined:
    Jul 11, 2009
    #7
    Deploystudio is a boot environment that's used to image a Mac. It has the capability to run scripts post-imaging in the DeployStudio boot environment. Permissions won't be a factor as DeployStudio is specifically designed to do this sort of thing. You write a script, save it as a file, then add a deployment step that runs that script. It'd even be possible to actually deploy a plist directly after imaging but before booting the client OS.
     
  8. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #8
    Then that might be another option.

    I don't have 10.10 on anything here. I checked the following on several OS X versions I do have, and they all showed the same.

    Here's what I did:

    1. Show the current plist:
    Code:
    /usr/libexec/PlistBuddy -c print /Library/Preferences/com.apple.loginwindow.plist
    
    Example output:
    Code:
    Dict {
        RetriesUntilHint = 3
        autoLoginUser = mr.cipher
        OptimizerLastRunForSystem = SOME_NUMBER
        lastUserName = mr.cipher
        autoLoginUserUID = 666
        SecureEraseOption = 0
        MasterPasswordHint = sympathy
        lastUser = loggedIn
        OptimizerLastRunForBuild = SOME_NUMBER
        MCXLaunchOnLogout = true
    }
    
    2. Change a setting in System Preferences.
    System Preferences > Users & Groups > Login Options > Display login window as:
    Change the radio button to: Name and password

    3. Run the command in Terminal again:
    Code:
    /usr/libexec/PlistBuddy -c print /Library/Preferences/com.apple.loginwindow.plist
    
    Example output:
    Code:
    Dict {
        RetriesUntilHint = 3
        autoLoginUser = mr.cipher
        OptimizerLastRunForSystem = SOME_NUMBER
        lastUserName = mr.cipher
        autoLoginUserUID = 666
        SecureEraseOption = 0
        MasterPasswordHint = sympathy
        lastUser = loggedIn
        OptimizerLastRunForBuild = SOME_NUMBER
        SHOWFULLNAME = true
        MCXLaunchOnLogout = true
    }
    
    Notice the SHOWFULLNAME item and its value.

    4. Go back to System Preferences and change the setting to "List of users".
    Then go back to Terminal and run the command again.
    The value of SHOWFULLNAME should change to false.​

    Since PlistBuddy can accept commands on its command-line, one can script it to set SHOWFULLNAME as desired.

    Or one can copy the plist, possibly change other values such as autoLoginUser, and apply it.
     

Share This Page