Cannot unlock Users & Groups settings I was making some changes recently, trying to rename my user account from the macOS High Sierra System Preferences, and it seems I've locked myself out from making any changes to Users &amp; Groups now.

When I click the lock icon (Click the lock to make changes) I am prompted for a User Name and Password. No matter what I input in these fields I am unable to unlock the preferences. I am sure I know my user account, otherwise I wouldn't be able to log into the computer, and there is only 1 user on my Mac.

I've also tried with:

sudo dscl . -merge /Groups/admin GroupMembership &lt;username&gt;
Password:
&lt;username&gt; is not in the sudoers file.  This incident will be reported.


So it seems the name change is causing a mismatch between what's in the sudoers file, so I basically have no user with admin access right now.

Does anyone know how I can reset these, even from the command line?
Thanks in advance!
You're best bet is probably to just boot into macOS Recovery mode and then use the resetpassword command in Terminal to reset your password.

More specifically:


Power off your Mac
Boot into Recovery Mode by holding down the CommandR keys while powering up your Mac
If prompted, select your language and press enter
Go to Utilities > Terminal.
Enter resetpassword (all one word, lowercase letters)
Press Return
Select the drive with your account (typically the main drive)
Choose your account using Select the User Account.
Enter a new password 
Re-enter the same password
Enter a password hint
Click Save 
Ignore the warning about the password changing
Click OK.
Shutdown your Mac by going to Apple > Shut Down
Restart your Mac normally and use the new password to log into your account
Once logged in, test to see whether you can unlock the Users &amp; Groups preferences pane


Next steps

If you still can't unlock the Users &amp; Groups preferences pane after the above steps, it may well be that you have no Admin account on your Mac. If so, refer to the following for further info:


I don&#39;t have administrator account on my mac
From Standard to Administrator