Admin account does not have sudo?

Hello, apparently my one and only user account (excluding the root account etc.) is not in the sudoers file. How should I fix it such that I can access sudo again?User uploaded file

MacBook Pro with Retina display, OS X El Capitan (10.11.5), Soon Running macOS Sierra beta

Posted on Sep 3, 2016 7:08 AM

Reply
2 replies

Sep 3, 2016 7:23 AM in response to The LEGOers

The default sudoers file has the "admin" group set for using sudo.

You can check the membership of the admin group with Directory Utility.

On the Directory Editor tab, choose Groups from the Viewing Popup menu.

Select the Administrators group.

Look for the GroupMembership line and click the triangle to disclose the contents.

If your user is not in that group, you can try to add it. You must first click the Padlock to authenticate.


If you are already in that group, or you cannot authenticate, you may have a corrupt sudoers file.

You may be able to create a new admin user that can use sudo. If so, you may be able to then repair it from that user.

Sep 3, 2016 7:42 AM in response to The LEGOers

If you are in the admin group, then you try creating a new admin user.

Log into that user and run this in the terminal

sudo visudo

Opening it and saving it may correct the problem. However, if it doesn't open or filled with garbage characters, then you might need to edit it.

If that is the case, I can show you what it should look like.

You can learn to edit in Vim by running this command in the Terminal:

vimtutor

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Admin account does not have sudo?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.