I am attempting to automate the setup of a vsts 'build agent' for mac, as documented here: https://www.visualstudio.com/en-us/docs/build/admin/agents/v2-osx
One recommended step, that is definitely useful in our usecase is to configure autologin (and lock), and the step links to this guide:
https://www.engadget.com/2011/03/07/terminally-geeky-use-automatic-login-more-securely/
I've found many references to the system preferences GUI approach, which did work when I tested by hand, but few to the command line approach, which is what I would like to do for my script. Some command line approaches are outdated, with references to 'systemsetup' which is no longer available. We are currently on 10.11, and planning to move to 10.12 at some point, so any approach for these systems would be appreciated.
I have found reference to the 'autoLoginUser' plist setting, which I have tested. It can be set with commands like:
sudo defaults write /Library/Preferences/com.apple.loginwindow autoLoginUser "buildagent"
This value IS set when the preferences are set, but it is not sufficient by itself.
Can this be done entirely from the command line, such as via a script? if so, how?
sudo defaults write /Library/Preferences/com.apple.loginwindow autoLoginUser
to detect if it is enabled, and prompting with an error if it is not.