4

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 & 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 <username>
Password:
<username> 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!

  • 2
    If you don't think you have any admin account on the Mac try this - apple.stackexchange.com/questions/164331/… You can then fix your existing admin account from the new one. – Tetsujin Dec 27 '17 at 9:22
  • Glad it helped :) – Tetsujin Dec 27 '17 at 9:45
  • Just happened the same to me. If you find a solution please share! Thanks in advance! – user286457 Apr 22 '18 at 22:10
3

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:

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

Next steps

If you still can't unlock the Users & 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've reset the password in the way you described but that is not the issue, as I've always been able to log in without a problem. The problem is that when trying to unlock Users & Groups preferences, I am prompted for a User Name and Password. No matter what I try to input here fails to work. I think that I currently have no user with administrative privileges, which would explain the issue. No idea how that happened, however. I do have a Time Machine backup so reinstalling everything shouldn't be too bad but I'd like to leave that as a last resort if possible. – DaniG2k Dec 27 '17 at 9:15
  • 1
    Ok, I've added some extra info to my answer. Let me know if this resolves it for you. – Monomeeth Dec 27 '17 at 9:45
  • 1
    Thanks! The link that @Tetsujin mentioned did the trick for me. – DaniG2k Dec 27 '17 at 14:04

You must log in to answer this question.

protected by Community Apr 22 '18 at 22:48

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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