4

I recently changed an account password by accident, and was wondering how to set it back to a blank password via the shell. I have root privileges. Please help :)

passwd USER doesn't accept blank passwords

2
  • You really want a blank password? From a security perspective, that's not at all a good idea. Commented Jun 5, 2011 at 3:39
  • The password prompt used by (the default bash) sudo doesn't accept an empty password either — even if you changed to one you couldn't really use it without some workaround.
    – Lri
    Commented Jun 7, 2011 at 14:15

3 Answers 3

5

The passwd command rejects the idea that you can have a 0 length password.

Instead use dscl which is more accepting of the notion that the password is nothing.

dscl . -passwd /Users/foo

You can press enter to make the new password blank and then may get an error and have to enter the old password if you are not root

Once you authenticate (or are root already) the blank password will be set for the account in question.

2
  • Doesn't seem to work in Monterey?
    – d-b
    Commented Jan 16, 2023 at 12:34
  • ´% sudo dscl . -passwd /Users/gast New Password: Permission denied. Please enter user's old password: passwd: DS error: eDSAuthPasswordQualityCheckFailed <dscl_cmd> DS Error: -14165 (eDSAuthPasswordQualityCheckFailed)´
    – d-b
    Commented Jan 16, 2023 at 12:34
3

You can set the account password to no password using the Users and Groups Pane in System Preferences.

3
  • 1
    I'd wager the preference pane is calling dscl and not passwd :-)
    – bmike
    Commented Jun 3, 2011 at 22:27
  • 1
    This is not true for the first (and only, if you are me) account. There is no such option, at least in Sierra. I think that this is now no longer allowed for the first user of the machine in Sierra.
    – zeeple
    Commented Mar 21, 2018 at 17:38
  • 2
    This answer is no longer true.
    – motoku
    Commented Apr 17, 2018 at 3:02
-1

macOS no longer allows this using the System Preferences and this is why.

macOS and iOS turn on sharing of all your photos by default so that Apple can keep all the photos of billions of people on their servers.

Additionally they by default turn on iCloud end-to-end encryption for some specific things on your devices and that end-to-end encryption is secured using your local device login password.

Apple wants you to store all your life on Apple servers and they cannot do that if you do not have a local device password. So that is why you are not able to NOT set a password.

3
  • There are a lot of reasons why empty passwords are a bad idea. But I'm quite sure that the ones you list here aren't amongst them.
    – nohillside
    Commented Mar 9, 2022 at 6:46
  • Of course it is. iCloud will not turn on unless you give it your local device password. Services made Apple $68B in revenue last year of which iCloud is an important sticky part. This is a very strong motivation and should be assumed relevant unless there's strong contradictory evidence. Commented Mar 9, 2022 at 16:00
  • As written the answer basically says that "Apple prohibits empty passwords because these would prevent them from selling more iCloud services". If this really is your claim here, please provide a link or similar which shows that this indeed is a specific decision made by Apple. Without this, it rather seems as if you have an axe to grind with Apple here.
    – nohillside
    Commented Mar 9, 2022 at 16:08

You must log in to answer this question.

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