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

Mr.B1ack

macrumors newbie
Original poster
Feb 27, 2016
3
0
Hello,

this is my first post and I was hoping to get some help with a problem. Whenever I try and use the Sudo command I get the following error message:

sudo: /etc/sudoers is owned by uid 503, should be 0
sudo: no valid sudoers sources found, quitting

I have tried logging into single user mode and typing in the following commands:

mount -uw

chown /private/etc/sudoers 0

After typing in the chown ownership line, I get an error message saying “illegal username”.

Different things I have tried:
- Reinstalling the os (El Capitan)
- Disabling System Integrity Protection (SIP).
- Calling Apple Care who say that Sudo commands have been disabled in El Capitan.

FYI

When I run ls -la /private/etc/sudoers in Terminal, I get the following:


-rw-r-----@ 1 MY-ADMIN-USERNAME staff 67 18 Feb 14:03 /private/etc/sudoers


Note I’ve replaced my actual admin username with “MY-ADMIN-USERNAME” just so you know what’s showing.

I need Sudo commands to work for a range of reasons, one of which is to get CrashPlan to work.

Any advice would be greatly appreciated.
 

KALLT

macrumors 603
Sep 23, 2008
5,380
3,415
chown expects the username first instead of the file.
Code:
chown root:wheel /private/etc/sudoers

This is a serious problem though and you really should look into how this happened in the first place. Consider doing a full system install via the App Store (basically like you were upgrading from an older system to El Capitan). If that does not work, consider a system wipe and restore with Migration Assistant.
 

Mr.B1ack

macrumors newbie
Original poster
Feb 27, 2016
3
0
Thanks for your suggestions KALLT.

When I type in the code you suggested, I get the message "Operation not permitted".

Regarding your other suggestions, reinstalling El Capitan via the app store AND doing a system wipe and restore with Migration Assistant are amongst the things I've tried. They didn't work unfortunately.

Bizarrely, the Apple care person I spoke to today claims that El Capitan disables Sudo commands. That sounds wrong. I'm pretty sure I was able to use it in El Capitan the first time I installed it (I've done a number of wipe and reinstalls for various reasons).
 
Last edited:

KALLT

macrumors 603
Sep 23, 2008
5,380
3,415
When I type in the code you suggested, I get the message "Operation not permitted".

Are you using the chmod command from the same user account that owns the sudoers file? You can also enter single-user mode by holding down command-S upon boot (do not use the mount command for this). Alternatively, try changing it from Recovery by navigating to your Macintosh volume with the cd command and then trying it from there.

Regarding your other suggestions, reinstalling El Capitan via the app store AND doing a system wipe and restore with Migration Assistant is one of the things I've tried. It didn't work unfortunately.

What kind of hardware setup do you have? Have you made any changes to your hard drive? In Disk Utility, can you check whether the parameter ‘Owners enabled’ of your Macintosh HD is set to ‘yes’?
 
Last edited:

Mr.B1ack

macrumors newbie
Original poster
Feb 27, 2016
3
0
Are you using the chmod command from the same user account that owns the sudoers file? You can also enter single-user mode by holding down command-S upon boot (do not use the mount command for this). Alternatively, try changing it from Recovery by navigating to your Macintosh volume with the cd command and then trying it from there.

I've done it in my standard account, admin account, root account and single user mode. In the Standard and Admin, it gives the "Operation not permitted" error message. In Single User Mode it gives the error message "Read-only File System".


What kind of hardware setup do you have? Have you made any changes to your hard drive? In Disk Utility, can you check whether the parameter ‘Owners enabled’ of your Macintosh HD is set to ‘yes’?

Imac 2010, 3.2GHZ, 16GB RAM, 500GB SSD - The SSD was installed about a year ago. Under Disk Utility, the "Owners" parameter shows as "Enabled".
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.