Pergunta

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

Foi útil?

Solução

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

Licenciado em: CC-BY-SA com atribuição
Não afiliado a apple.stackexchange
scroll top