Is there a way to reset the login password on big sur using the terminal?

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


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>