salt.modules.mac_shadow module

2016.3.0 新版功能.

Manage Mac OSX local directory passwords and policies.

Note that it is usually better to apply password policies through the creation of a configuration profile.

salt.modules.mac_shadow.del_password(name)

Deletes the account password

参数:name (str) -- The user name of the account

CLI Example:

salt '*' shadow.del_password username
salt.modules.mac_shadow.get_account_created(name)

Get the date/time the account was created

参数:name (str) -- the username of the account
返回:the date/time the account was created (yyyy-mm-dd hh:mm:ss)
返回类型:str

CLI Example:

salt '*' shadow.get_account_created admin
salt.modules.mac_shadow.get_change(name)

Gets the date on which the password expires.

参数:name (str) -- the name of the user account
返回:The date the password will expire
返回类型:datetime

CLI Example:

salt '*' shadow.get_change username
salt.modules.mac_shadow.get_expire(name)

Gets the date on which the account expires.

参数:name (str) -- the name of the user account
返回:the date the account expires

CLI Example:

salt '*' shadow.get_expire username
salt.modules.mac_shadow.get_last_change(name)

Get the date/time the account was changed

参数:name (str) -- the username of the account
返回:the date/time the account was modified (yyyy-mm-dd hh:mm:ss)
返回类型:str

CLI Example:

salt '*' shadow.get_last_change admin
salt.modules.mac_shadow.get_login_failed_last(name)

Get the date/time of the last failed login attempt

参数:name (str) -- the username of the account
返回:the date/time of the last failed login attempt on this account

(yyyy-mm-dd hh:mm:ss) :rtype: str

CLI Example:

salt '*' shadow.get_login_failed_last admin
salt.modules.mac_shadow.get_maxdays(name)

Get the maximum age of the password

参数:name (str) -- the username of the account
返回:the maximum age of the password in days
返回类型:int

CLI Example:

salt '*' shadow.get_maxdays admin 90
salt.modules.mac_shadow.info(name)

Return information for the specified user

参数:name (str) -- the username
返回:A dictionary containing the user's shadow information
返回类型:dict

CLI Example:

salt '*' shadow.info admin
salt.modules.mac_shadow.set_change(name, date)

Sets the date on which the password expires. The user will be required to change their password. Format is mm/dd/yy

参数:
  • name (str) -- the name of the user account
  • date (date) -- the date the password will expire. Must be in mm/dd/yy

format.

CLI Example:

salt '*' shadow.set_change username 09/21/16
salt.modules.mac_shadow.set_expire(name, date)

Sets the date on which the account expires. The user will not be able to login after this date. Date format is mm/dd/yy

参数:
  • name (str) -- the name of the user account
  • date (datetime) -- the date the account will expire. Format must be

mm/dd/yy

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

CLI Example:

salt '*' shadow.set_expire username 07/23/15
salt.modules.mac_shadow.set_inactdays(name, days)

Set the number if inactive days before the account is locked. Not available in OS X.

salt.modules.mac_shadow.set_maxdays(name, days)

Set the maximum age of the password in days

参数:
  • name (str) -- the username of the account
  • days (int) -- the maximum age of the account in days
返回:

True if successful, False if not

返回类型:

bool

CLI Example:

salt '*' shadow.set_maxdays admin 90
salt.modules.mac_shadow.set_mindays(name, days)

Set the minimum password age in days. Not available in OS X.

salt.modules.mac_shadow.set_password(name, password)

Set the password for a named user (insecure, the password will be in the process list while the command is running).

参数:name (str) -- The name of the local user, which is assumed to be in the

local directory service.

参数:password (str) -- The plaintext password to set

CLI Example:

salt '*' mac_shadow.set_password macuser macpassword
salt.modules.mac_shadow.set_warndays(name, days)

Set the number of days before the password expires that the user will start to see a warning. Not available in OS X.