47

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?

4
  • 1
    What about setting up with longer password and then changing to a short password with passwd command?
    – JBis
    Sep 25, 2018 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. Sep 26, 2018 at 22:39
  • Great. Use 4 characters I will add answer and edit if I find better solution.
    – JBis
    Sep 26, 2018 at 23:18
  • 1
    Found the answer please hold on the line while I transfer you....
    – JBis
    Sep 26, 2018 at 23:25

2 Answers 2

36

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 | awk 'NR>1' > ~/Desktop/file.plist

  2. nano ~/Desktop/file.plist

  3. Change the quoted part to your Regex.

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

  5. 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

6
  • 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, 2019 at 11:37
  • 4
    @Motsel Step 3.
    – JBis
    Mar 27, 2019 at 11:41
  • 🤦🏼‍♂️😴👍🏼🎉
    – Motsel
    Mar 27, 2019 at 16:25
  • Looks like you duplicate the policy, then point system to look at the new policy file. How do you revert? (i.e., get the system to look at the default policy file).
    – FeFiFoFu
    Sep 28, 2019 at 17:03
  • 1
    David's solution works for me with Big Sur and is much easier
    – Guenter
    Dec 31, 2020 at 17:38
85

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.

6
  • Worked for me, thanks! MacOS Mojave (10.14.2)
    – Tim N.
    Jan 7, 2019 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! Jan 25, 2019 at 22:16
  • 3
    Thank you so much! :D, I should keep that line in mind. now I can use my one letter password xD
    – user318860
    Jan 26, 2019 at 22:20
  • Works perfectly.
    – wonsuc
    Aug 11, 2019 at 21:45
  • 2
    this is the solution... the others are a "fix"...
    – ZEE
    Oct 22, 2019 at 17:06

You must log in to answer this question.

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