I was trying to overwrite global policies and I found a way to do it, like this:
Redirect existing global policies in a new XML file:
pwpolicy -getaccountpolicies > ~/globalPolicies.xml
Edit ~/globalPolicies.xml and remove the first line, "Getting global account policies".
Modify the rules in globalPolicies.xml and save it as ~/globalPolicies.plist
pwpolicy -setaccountpolicies ~/globalPolicies.plist
Even though the above procedure is initially successful, as I can see by checking the policies, when I logout and login back again or restart my computer, the original global policies are restored. The outcome is the same either with sudo or not.
So, what I should do in order for my changes to have a permanent effect?
My computer is a Macbook Pro 2017 with macOS Catalina version 10.15.6.