| pwpolicy(8) | System Manager's Manual | pwpolicy(8) |
pwpolicy — gets
and sets password policies
pwpolicy |
[-h] |
pwpolicy |
[-v] [-a
authenticator] [-p
password] [-u
username | -c
computername] [-n
nodename] command command-arg |
pwpolicy |
[-v] [-a
authenticator] [-p
password] [-u
username | -c
computername] [-n
nodename] command "policy1=value1
policy2=value2 ..."
|
pwpolicy manipulates password
policies.
-getglobalpolicy-setglobalpolicy-getpolicy--get-effective-policy-setpolicy-setpassword-enableuser-disableuser-getglobalhashtypes-setglobalhashtypes-gethashtypes-sethashtypes-setaccountpolicies-getaccountpolicies-clearaccountpolicies-authentication-allowedAccount policies are the replacement for the deprecated legacy global and user policies. Account policies are specified as a dictionary containing three keys, one key for each policy category. Note that the dictionary is not required to contain all of the policy categories. Valid keys for the policy categories are:
Each policy category contains an array of individual policy dictionaries. Valid keys in the policy dictionary are:
Below is an example account policy dictionary. Not all policy categories need be present in the dictionary.
<dict>
<key>policyCategoryPasswordAuthentication</key>
<array>
<dict>
<key>policyContent</key>
<string>policyAttributeMaximumFailedAuthentications < policyAttributeFailedAuthentications</string>
<key>policyIdentifier</key>
<string>failed auths</string>
</dict>
</array>
<key>policyCategoryPasswordChange</key>
<array>
<dict>
<key>policyContent</key>
<string>policyAttributeCurrentTime > policyAttributeLastPasswordChangeTime + policyAttributeExpiresEveryNDays * DAYS_TO_SECONDS</string>
<key>policyIdentifier</key>
<string>Change every 30 days</string>
<key>policyParameters</key>
<dict>
<key>policyAttributeExpiresEveryNDays<key>
<integer>30</integer>
</dict>
</array>
<key>policyCategoryPasswordContent</key>
<array>
<dict>
<key>policyContent</key>
<string>policyAttributePassword matches '.{3,}+'</string>
<key>policyIdentifier</key>
<string>com.apple.policy.legacy.minChars</string>
<key>policyParameters</key>
<dict>
<key>minimumLength</key>
<integer>3</integer>
</dict>
</dict>
</array>
</dict>
The following keywords may be used in the policy content. The values from the user's record will be substitued for the keyword when the policy is evaluated. User-defined keywords may also be used, as long the keyword is present in the policy's parameters dictionary.
usingHistoryusingExpirationDateusingHardExpirationDaterequiresAlpharequiresNumericexpirationDateGMThardExpireDateGMTvalidAftermaxMinutesUntilChangePasswordmaxMinutesUntilDisabledmaxMinutesOfNonUsemaxFailedLoginAttemptsminCharsmaxCharsisDisabledisAdminUsernewPasswordRequiredcanModifyPasswordforSelfCRAM-MD5RECOVERABLESALTED-SHA512-PBKDF2SALTED-SHA512SMB-NTSALTED-SHA1SHA1To get global policies:
pwpolicy -getglobalpolicyTo set global policies:
pwpolicy -a authenticator -setglobalpolicy
"minChars=4 maxFailedLoginAttempts=3"To get policies for a specific user account:
pwpolicy -u user -getpolicypwpolicy -u user -n /NetInfo/DefaultLocalNode
-getpolicyTo set policies for a specific user account:
pwpolicy -a authenticator -u user -setpolicy
"minChars=4 maxFailedLoginAttempts=3"To change the password for a user:
pwpolicy -a authenticator -u user -setpassword
newpasswordTo set the list of hash types for local accounts:
pwpolicy -a authenticator -setglobalhashtypes
SMB-LAN-MANAGER off SMB-NT on| 13 November 2002 | Mac OS X |