I added

"Syammala Naidu" ALL=(ALL) ALL

to /etc/sudoers, rebooted and logged in as Syammala Naidu and run sudo -i. Sudo tells me: user not in sudoers file, incident Reported.

How can I fix this?


sudo exclusively uses account names, not the user's full name. As a hint, account names don't contain spaces, so "Syammala Naidu" is not correct.

To find out a user's account name:

  1. Open System Preferences.
  2. Select Users & Groups.
  3. If necessary, click the lock on the bottom left corner of the window and type an administrator's name and password to unlock the preference pane.
  4. Right-click the account and select Advanced Options....
  5. Locate the Account name property:

    enter image description here

    Use that account name in /etc/sudoers. To edit the file, use visudo. For more information, check man visudo and man sudoers.

  • 1
    Or look at the name of the home folder, the account name is the part after /Users/ :-) – nohillside Jun 10 '15 at 7:06
  • 2
    @patrix: By default, yes, but the home directory can made to differ from the account name, even through System Preferences. Looking at the account name as described is better, more reliable advice. – Terry N Oct 28 '17 at 22:28

You must log in to answer this question.

protected by Mark Nov 3 '17 at 12: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 .