salt.modules.mac_user

Manage users on Mac OS 10.7+

salt.modules.mac_user.add(name, uid=None, gid=None, groups=None, home=None, shell=None, fullname=None, createhome=True, **kwargs)

Add a user to the minion

CLI 范例:

salt '*' user.add name <uid> <gid> <groups> <home> <shell>
salt.modules.mac_user.chfullname(name, fullname)

Change the user's Full Name

CLI 范例:

salt '*' user.chfullname foo 'Foo Bar'
salt.modules.mac_user.chgid(name, gid)

Change the default group of the user

CLI 范例:

salt '*' user.chgid foo 4376
salt.modules.mac_user.chgroups(name, groups, append=False)

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
Groups to which the user should belong, can be passed either as a python list or a comma-separated string
append
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 范例:

salt '*' user.chgroups foo wheel,root
salt.modules.mac_user.chhome(name, home)

Change the home directory of the user

CLI 范例:

salt '*' user.chhome foo /Users/foo
salt.modules.mac_user.chshell(name, shell)

Change the default shell of the user

CLI 范例:

salt '*' user.chshell foo /bin/zsh
salt.modules.mac_user.chuid(name, uid)

Change the uid for a named user

CLI 范例:

salt '*' user.chuid foo 4376
salt.modules.mac_user.delete(name, *args)

Remove a user from the minion

CLI 范例:

salt '*' user.delete foo
salt.modules.mac_user.disable_auto_login()

2016.3.0 新版功能.

Disables auto login on the machine

返回:True if successful, False if not
返回类型:bool

CLI 范例:

salt '*' user.disable_auto_login
salt.modules.mac_user.enable_auto_login(name)

2016.3.0 新版功能.

Configures the machine to auto login with the specified user

参数:name (str) -- The user account use for auto login
返回:True if successful, False if not
返回类型:bool

CLI 范例:

salt '*' user.enable_auto_login stevej
salt.modules.mac_user.get_auto_login()

2016.3.0 新版功能.

Gets the current setting for Auto Login

返回:If enabled, returns the user name, otherwise returns False
返回类型:str, bool

CLI 范例:

salt '*' user.get_auto_login
salt.modules.mac_user.getent(refresh=False)

Return the list of all info for all users

CLI 范例:

salt '*' user.getent
salt.modules.mac_user.info(name)

Return user information

CLI 范例:

salt '*' user.info root
salt.modules.mac_user.list_groups(name)

Return a list of groups the named user belongs to.

name

The name of the user for which to list groups. Starting in Salt Carbon, all groups for the user, including groups beginning with an underscore will be listed.

在 Carbon 版更改.

CLI 范例:

salt '*' user.list_groups foo
salt.modules.mac_user.list_users()

Return a list of all users

CLI 范例:

salt '*' user.list_users
salt.modules.mac_user.rename(name, new_name)

Change the username for a named user

CLI 范例:

salt '*' user.rename name new_name