0

As the title says…

Searching online the way to do it is while logged in as the user:

sudo security set-keychain-password -o oldpassword -p newpassword /Users/username/Library/Keychains/login.keychain

Or:

sudo /usr/bin/dscl . -passwd /Users/username newpassword
sudo security set-keychain-password -o oldpassword -p newpassword /Users/username/Library/Keychains/login.keychain

These methods don’t seem to work on big sur.

I just prefer using the terminal coming from a Linux background.

Also has the added benefit of not wearing down your touchpad and stepping though a million GUIs.

That’s why I got a Mac, I was sick of windows, how slow it is and the constant updates (Mac is definitely better).

Error message:

security: error changing password for "/Users/apple/Library/Keychains/login.keychain-db": The user name or passphrase you entered is not correct.

I just tried logging in using the exact same password I used for the -o option and it worked

/Users/apple/Library/Keychains/login.keychain does not exist so I manually added it using touch but I get the same message

13
  • It‘s three or four dialogs and few clicks, don‘t think you need to worry about wearing out any hardware. Anyway, what does „not work“ mean: error message, no effect, something else?
    – nohillside
    May 30 at 8:00
  • Yeah I’m just not into using the GUI, I’ll grab the error message
    – Nickotine
    May 30 at 8:01
  • You can‘t create login.keychain by touch‘ing it. Find out where it actually is and use the correct path.
    – nohillside
    May 30 at 8:16
  • 1
    We don’t see your screen so we don’t know which guide you are following. But try man security.
    – nohillside
    May 30 at 9:14
  • 1
    Calling people names won‘t help in getting answers. Please add the link to the guide if you want to provide context. Anyway, as you now found the path to the keychain, does changing the password work if you use the correct path?
    – nohillside
    May 30 at 9:24
3

I just tried on 11.4:

dscl . -passwd /Users/$USER 'newpassword'
security set-keychain-password -o 'oldpassword' -p 'newpassword' /Users/$USER/Library/Keychains/login.keychain-db

will change the password of the user currently logged in,

sudo dscl . -passwd /Users/otheruser 'newpassword'
sudo security set-keychain-password -o 'oldpassword' -p 'newpassword' /Users/otheruser/Library/Keychains/login.keychain-db

will change the password of user otheruser.

In both cases, dscl prompts for the old password (of $USER or otheruser, respectively).

2
  • thank you @nohillside for the earnest attempt at helping this time... I guess you just needed a little push before you stopped with the generic suggestions... I will try this on a new user, I'm still using the user this laptop came with, I got this error <dscl_cmd> DS Error: -14090 (eDSAuthFailed) but I appreciate your response thank you
    – Nickotine
    May 30 at 11:05
  • I didn’t get prompted like you said
    – Nickotine
    May 30 at 12:31
1

Rather than use that convoluted cmd this one is better, it changes sudo and login pass, like you'd expect sudo passwd to do: except on Mac it doesn't.

sysadminctl -adminUser <user> -adminPassword <pass> -resetPasswordFor <user> -newPassword <newPass>
3
  • Does it also change the keychain password?
    – nohillside
    Jun 4 at 4:11
  • I’m assuming yes since the GUI login resets and without keychain password being updated you can’t change the GUI login
    – Nickotine
    Jun 6 at 1:21
  • 1
    When I tried this on Big Sur, I thought it didn't work after I saw this: "sysadminctl[20929:1457646] resetting password for <my name>. (Keychain will not be updated!)" But despite the message, my keychain password was changed. Oct 5 at 14:40

You must log in to answer this question.

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