Manage users on Mac OS 10.7+
Important
If you feel that Salt should be using this module to manage users on a minion, and it is using a different module (or gives an error similar to 'user.info' is not available), see here.
Add a user to the minion
CLI Example:
salt '*' user.add name <uid> <gid> <groups> <home> <shell>
Change the user's Full Name
CLI Example:
salt '*' user.chfullname foo 'Foo Bar'
Change the default group of the user
CLI Example:
salt '*' user.chgid foo 4376
Change the groups to which the user belongs. Note that the user's primary group does not have to be one of the groups passed, membership in the user's primary group is automatically assumed.
Groups to which the user should belong, can be passed either as a python list or a comma-separated string
Instead of removing user from groups not included in the groups
parameter, just add user to any groups for which they are not members
CLI Example:
salt '*' user.chgroups foo wheel,root
Change the home directory of the user
CLI Example:
salt '*' user.chhome foo /Users/foo
Change the default shell of the user
CLI Example:
salt '*' user.chshell foo /bin/zsh
Change the uid for a named user
CLI Example:
salt '*' user.chuid foo 4376
Remove a user from the minion
CLI Example:
salt '*' user.delete name remove=True force=True
New in version 2016.3.0.
Disables auto login on the machine
True
if successful, otherwise False
CLI Example:
salt '*' user.disable_auto_login
New in version 2016.3.0.
Configures the machine to auto login with the specified user
True
if successful, otherwise False
CLI Example:
salt '*' user.enable_auto_login stevej
New in version 2016.3.0.
Gets the current setting for Auto Login
CLI Example:
salt '*' user.get_auto_login
Return the list of all info for all users
CLI Example:
salt '*' user.getent
Return user information
CLI Example:
salt '*' user.info root
Return a list of groups the named user belongs to.
name
The name of the user for which to list groups. Starting in Salt 2016.11.0, all groups for the user, including groups beginning with an underscore will be listed.
Changed in version 2016.11.0.
CLI Example:
salt '*' user.list_groups foo
Return a list of all users
CLI Example:
salt '*' user.list_users
Return the primary group of the named user
New in version 2016.3.0.
CLI Example:
salt '*' user.primary_group saltadmin
Change the username for a named user
CLI Example:
salt '*' user.rename name new_name