Manage macOS local directory passwords and policies
New in version 2016.3.0.
Note that it is usually better to apply password policies through the creation of a configuration profile.
Deletes the account password
name (str) -- The user name of the account
True if successful, otherwise False
CommandExecutionError on user not found or any other unknown error
CLI Example:
salt '*' shadow.del_password username
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) or 0 if the value is not defined
CommandExecutionError on user not found or any other unknown error
CLI Example:
salt '*' shadow.get_account_created admin
Gets the date on which the password expires
name (str) -- The name of the user account
The date the password will expire
CommandExecutionError on user not found or any other unknown error
CLI Example:
salt '*' shadow.get_change username
Gets the date on which the account expires
name (str) -- The name of the user account
The date the account expires
CommandExecutionError on user not found or any other unknown error
CLI Example:
salt '*' shadow.get_expire username
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) or 0 if the value is not defined
CommandExecutionError on user not found or any other unknown error
CLI Example:
salt '*' shadow.get_last_change admin
Get the number of failed login attempts
name (str) -- The username of the account
The number of failed login attempts. 0 may mean there are no failed login attempts or the value is not defined
CommandExecutionError on user not found or any other unknown error
CLI Example:
salt '*' shadow.get_login_failed_count admin
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) or 0 if the value is not defined
CommandExecutionError on user not found or any other unknown error
CLI Example:
salt '*' shadow.get_login_failed_last admin
Get the maximum age of the password
name (str) -- The username of the account
The maximum age of the password in days
CommandExecutionError on user not found or any other unknown error
CLI Example:
salt '*' shadow.get_maxdays admin 90
Return information for the specified user
name (str) -- The username
A dictionary containing the user's shadow information
CLI Example:
salt '*' shadow.info admin
Sets the date on which the password expires. The user will be required to change their password. Format is mm/dd/yyyy
name (str) -- The name of the user account
date (date) -- The date the password will expire. Must be in mm/dd/yyyy format.
True if successful, otherwise False
CommandExecutionError on user not found or any other unknown error
CLI Example:
salt '*' shadow.set_change username 09/21/2016
Sets the date on which the account expires. The user will not be able to login after this date. Date format is mm/dd/yyyy
name (str) -- The name of the user account
date (datetime) -- The date the account will expire. Format must be mm/dd/yyyy.
True if successful, False if not
CommandExecutionError on user not found or any other unknown error
CLI Example:
salt '*' shadow.set_expire username 07/23/2015
Set the number if inactive days before the account is locked. Not available in macOS
Will always return False until macOS supports this feature.
CLI Example:
salt '*' shadow.set_inactdays admin 90
Set the maximum age of the password in days
True if successful, False if not
CommandExecutionError on user not found or any other unknown error
CLI Example:
salt '*' shadow.set_maxdays admin 90
Set the minimum password age in days. Not available in macOS.
Will always return False until macOS supports this feature.
CLI Example:
salt '*' shadow.set_mindays admin 90
Set the password for a named user (insecure, the password will be in the process list while the command is running)
True if successful, otherwise False
CommandExecutionError on user not found or any other unknown error
CLI Example:
salt '*' mac_shadow.set_password macuser macpassword
Set the number of days before the password expires that the user will start to see a warning. Not available in macOS
Will always return False until macOS supports this feature.
CLI Example:
salt '*' shadow.set_warndays admin 90