MacOS – None of the admin accounts are sudo users

administratormacossudoterminal

I have three admin accounts on one machine running El Capitan. The machine is a few days old. Whenever I try to run a sudo command, I'm asked for my password and told

accountUsername is not in the sudoers file.  This incident will be reported.

However, all the instructions I can find for adding a user to the sudoers file require having at least one user that has sudo privileges. I've tried

sudo visudo and sudo adduser username sudo – but obviously both of those require the user to be a sudo user.

I'm not sure how I ended up in sudo purgatory. The only thing I can think of is – my employer created two additional admin accounts and then removed admin rights from my original account.

All accounts have since been upgraded to have admin privileges and the problem still persists.

Best Answer

It sounds like your employer has disabled using sudo commands from any admin account, instead opting to include only specific users. This would mean only the employer's admin account would be able to use sudo. If you no longer have access to this account, you could boot into Single User Mode and run the visudo command to fix it. If they didn't remove the user from the sudoers list, you could also make a new admin account with the same shortname.