19

I just installed macOS Mojave and put in my usual short desktop-only password I've been using for years (yes, you read that right). Now though, the operating system rejects setting a password less than 4 characters. It also does not allow having no password at all.

I am completely comfortable using the shell if need be.

How can I change the password policy to allow quite short passwords?

  • 1
    What about setting up with longer password and then changing to a short password with passwd command? – JBis Sep 25 '18 at 3:12
  • @JBis passwd outputs passwd: authentication token failure each time I attempt to change it to less than 4 characters. It works if I use 4 characters. – Eric Majerus Sep 26 '18 at 22:39
  • Great. Use 4 characters I will add answer and edit if I find better solution. – JBis Sep 26 '18 at 23:18
  • 1
    Found the answer please hold on the line while I transfer you.... – JBis Sep 26 '18 at 23:25
18

Optionally, learn a bit of the regular expression language - regex (this may take a while) and you can use the one crafted below for a 4 character length password. Here’s how to retrieve the configuration, edit that file, and then load it into the system:

  1. pwpolicy getaccountpolicies > ~/Desktop/file.plist
  2. nano ~/Desktop/file.plist
  3. Delete the first line, which says Getting global account policies to make the file valid XML.
  4. Change the bolded part to your Regex.

    policyAttributePassword matches '`**`^$|.{4,}+`**`'
    
  5. pwpolicy setaccountpolicies ~/Desktop/file.plist

  6. passwd

Presets:

  • ^$|.{1,}+ : Any password. (Not the best Regex, but I didn't want to mess around with it too much.)

Confirmed this works with macOS Mojave (10.14).

Source: Modify pwpolicy in Sierra

  • This no longer works in Mojave 10.14.4 (the setaccountpolicies gives an error about wrong format.) See answer from @david-p below for a working solution. – Motsel Mar 27 at 11:37
  • 1
    @Motsel Step 3. – JBis Mar 27 at 11:41
  • 🤦🏼‍♂️😴👍🏼🎉 – Motsel Mar 27 at 16:25
20

You can also use the much more straightforward command:

pwpolicy -clearaccountpolicies

to remove the 4-character requirement for all users. The man page gives other useful examples if you want to change the policy on a per-user basis.

  • Worked for me, thanks! MacOS Mojave (10.14.2) – Tim N. Jan 7 at 2:23
  • David P. thank you very much! this Mojave requirement was driving me crazy! This totally works! you can even set a password blank Cheers! – Mike Van Rose Jan 25 at 22:16
  • Thank you so much! :D, I should keep that line in mind. now I can use my one letter password xD – user318860 Jan 26 at 22:20

You must log in to answer this question.

protected by Community Mar 25 at 14:59

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged .