Modify pwpolicy in Sierra I am trying to modify default Sierra password policies through pwpolicy, trying for example, to lower the depth of password history from 24 to 1 by hitting as sudoer:

sudo pwpolicy setaccountpolicies "policyAttributePasswordHistoryDepth=1"


But it is not working. The error message is:


  Error: Policy file  not found


The policyIdentifier I try to change that gets listed (with many more) when hitting pwpolicy getaccountpolicies reads like this:

&lt;key&gt;policyIdentifier&lt;/key&gt;             
&lt;string&gt;ProfilePayload:[HASHED_VALUE]:pinHistory&lt;/string&gt;           
&lt;key&gt;policyParameters&lt;/key&gt;             
&lt;dict&gt;
  &lt;key&gt;policyAttributePasswordHistoryDepth&lt;/key&gt;
  &lt;integer&gt;24&lt;/integer&gt;             
&lt;/dict&gt;


How is the proper way of doing it?
Ok, this is how I finally resolved it, though I am not sure if it is the properest way.

As @patrix pointed out, pwpolicy setaccountpolicies requires for the path of a XML file with the policies.

pwpolicy getaccountpolicies gives the current global policies in XML format, so I redirected the output to a file with
pwpolicy getaccountpolicies &gt; file.plist , removing the possible info messages the command might write and leaving only the XML structure.

&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt;
&lt;plist version="1.0"&gt;
&lt;dict&gt;
    &lt;key&gt;policyCategoryPasswordChange&lt;/key&gt;
    &lt;array&gt;
    ...
    &lt;/array&gt;
&lt;/dict&gt;
&lt;/plist&gt;


Then I changed the value I wanted to modify in my case, in the file I created (file.plist):

&lt;key&gt;policyIdentifier&lt;/key&gt;             
&lt;string&gt;ProfilePayload:[HASHED_VALUE]:pinHistory&lt;/string&gt;           
&lt;key&gt;policyParameters&lt;/key&gt;             
&lt;dict&gt;
  &lt;key&gt;policyAttributePasswordHistoryDepth&lt;/key&gt;
  &lt;integer&gt;2&lt;/integer&gt;             
&lt;/dict&gt;


Finally I used that file to update the policy:
pwpolicy setaccountpolicies /path/to/file.plist