Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

NonoVoyou

macrumors newbie
Original poster
Aug 11, 2021
1
0
Hello, every time i try a sudo command in Terminal on Mac OS Mojave, i get :

- sudo: no valid sudoers sources found, quitting

- sudo: unable to initialize policy plugin

I'm on the admin user called "Noa" but but the name of the macbook is in the name of sam.

When I open terminal I directly see "MacBook-Pro-de-sam: ~ sam $" as if sam was the administrator, while my user "noa" is designated admin, maybe that's the problem but I do not know how to solve it ..

Please help me and have a good day
 

Attachments

  • Capture d’écran 2021-08-11 à 12.01.57.png
    Capture d’écran 2021-08-11 à 12.01.57.png
    56.5 KB · Views: 781

QuentinWilson

macrumors newbie
Aug 21, 2018
19
20
The issue seems to be permissions on the sudoers file - sudo will not run if the file is suspected of being tampered with. Check the permissions by running ls -l /etc/sudoers. It should be 440, or -r--r-----. If it isn‘t, someone who knows the root password has to fix permissions by doing a su and chmod 440 /etc/sudoers. Maybe someone edited the sudoers file and didn‘t do it by running visudo. Whatever caused it, sudo will not work until permissions are fixed.
 
  • Like
Reactions: NoBoMac

NoBoMac

Moderator
Staff member
Jul 1, 2014
6,244
4,931
^^This.

Also, doesn't sound like the problem, but there was a string of OS updates that for me were resetting the sudoers file to defaults. Needed to add myself back in via visudo command. So, something else to look out for.

Been a while since I messed up a sudoers file, so memory is hazy, but might not need root to fix. First, in you admin account, try the visudo command, without and with using sudo. If that does not work, from the admin account, add write permissions for admin to the /etc/sudoers file. Repeat with visudo command.

Also, from the admin account can try: chown root:wheel /etc/sudoers

Nuclear option: download installer from App Store and install. Will keep non-OS accounts and files as is, but will install new versions of everything OS related, and fix all the systems permissions.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.