You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

sudo: can't open /private/etc/sudoers: Permission denied | sudo: no valid sudoers sources found, quitting

Hi,

I've had this problem before on an old machine and managed to fix it quite quickly, but the things I tried before don't seem to be working on this machine.


Basically, when I go in to Terminal and try running something with sudo, it just echoes:

sudo: can't open /private/etc/sudoers: Permission denied

sudo: no valid sudoers sources found, quitting


I also get the same message when booted in to Single user mode, thinking it might just have been an issue with my users id. I have already tried changing the file permissions, editing the sudoers file to add in my local users record etc...... but then it just gives me a different error message (eventually coming back to the above when I try changing something else to fix it).


I've run Applejack and Diskutility, but as expected they don't work either........


Any help would be much appreciated!- my new MacBook Pro won't even install anything requiring root permissions any longer, giving the same error message in the /var/log/install.log! :-(


As you can understand, I'm very upset because it is a new machine, and I have no idea what would have caused this to happen. The usual cause is editing the sudoers file without using visudo, but I can never recall doing that.


I need my root access back! 😟


Kind regards,

Aidan

iMac, Mac OS X (10.7.2), Hardware Serial: VM*****B9S

Posted on Jan 24, 2012 6:31 AM

Reply
42 replies

Dec 28, 2015 6:19 AM in response to KeithO Ep

Is there a command line command in the bash terminal?

sudo /usr/sbin/diskutil repairPermissions /

However, I'm not sure it will work unless you are logged in as root or you have sudo working, but if sudo is not working ... 🙂


I guess it could be done from single user mode. Or if you can get sudo working, then the rest can be done as a normal admin user via the 'sudo' command.

Jan 27, 2016 8:19 AM in response to Joshua Brown1

This guy is a true GENIUS...... Joshua's post helped me after hours and hours of Internet research on why I could not get certain *pkg files to install on my relatively new Macbook Pro 15 w/SSD / Yosemite. Even after trying all the "repair disk permissions" that were suggested I still had problems until I used Joshua's methods. Thank You Joshua...... You have no idea how much better I feel knowing I as the admin can know install some of the software that I wanted on the Mac side of my Bootcamped Macbook.

Regards,

Jeff Gray

Mar 13, 2016 8:54 AM in response to VikingOSX

VikingOSX, I think you've missed every post above you.


If people who have this problem try to use sudo, they will get the error message that everyone has been posting about, "sudo: unable to stat /etc/sudoers: Permission denied".


In these circumstances, sudo simply does not work. So you cant use sudo to edit sudoers with visudo, and you can't su to elevate your privileges to change the necessary permissions to allow you to use sudo.


That is why everyone is trying these more complex solutions - as everyone's been saying, they cant use the normal su/sudo commands.

Mar 13, 2016 9:02 AM in response to Joshua Brown1

Joshua, are you able to help me understand what's going wrong when I try to follow your instructions?


I carried them out, up to logging out and logging in as root. I entered 'root' and the new password - and then the screen went black and I had a mouse cursor pointer.


I could move the mouse around, but even after several minutes of waiting, nothing changed. I had to force the machine to shutd own. I'm on a 2015 MacBook Pro with an SSD, so I wasn't waiting for a hard drive to finish something.


Have you (or anyone else!) got any idea why this is happening? I'm on El Capitan, which might be the reason!


Thanks Joshua/everyone

sudo: can't open /private/etc/sudoers: Permission denied | sudo: no valid sudoers sources found, quitting

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