如何强制Mac使其密码不过期?

今天早上,当我登录Mac时,它迫使我更改了密码。因为我不太记得新密码,所以我不得不选择一个不容易记住的不安全密码。

它也不会让我更改密码。

我转到“安全和隐私”设置,发现“无”可以控制此行为。

Internet上甚至与远程相关的所有内容都与Active Directory有关,但是我确定这不是在使用Active Directory。

您如何使Mac不这样做?

评论
原静安
原静安

The feature is controlled by a tool called pwpolicy. Running pwpolicy -getaccountpolicies outputs an XML document. One of the things found in this XML is this:

<key>policyCategoryPasswordChange</key>
<array>
        <dict>
                <key>policyContent</key>
                <string>policyAttributeCurrentTime &gt; policyAttributeLastPasswordChangeTime + (policyAttributeExpiresEveryNDays * 24 * 60 * 60)</string>
                <key>policyIdentifier</key>
                <string>ProfilePayload:deadbeef-b187-1337-1ee7-abcdef123456:maxPINAgeInDays</string>
                <key>policyParameters</key>
                <dict>
                        <key>policyAttributeExpiresEveryNDays</key>
                        <integer>90</integer>
                </dict>
        </dict>
</array>

从XML文档中删除该文档,然后使用以下方法使用更改后的文档:

pwpolicy -setaccountpolicies <file.xml>

and the problem should go away. But there is a pitfall. If you dump the XML using the shell's > operator, edit the file, and pass it back to pwpolicy, you'll get this error:

Error: The data is not in the correct format.

The reason for this error is that pwpolicy -getaccountpolicies prints the following before printing the XML:

Getting global account policies
点赞
评论