I have a mac 10.8.2 mountain lion and when i try to use the sudo command i get this:
sudo: /private/etc/sudoers is owned by uid 501, should be 0
sudo: no valid sudoers sources found, quitting
I have searched google all over and tried a couple of things but one thing kinda fixed my orignal perm problem with 0440 being 0640 or something but i got this. Any help will be appreciated
How to Fix "sudo: command not found" on Linux. As your user cannot assume the privileges of the root user without already having sudo installed, you need to log out of your user account and log in as root. As root, you can install the sudo package with the privileges this account possesses.
The result can be an impaired instance that can't run sudo su or commands that require privileged user access. To fix this syntax error, stop the instance, detach its root volume, attach it to a recovery instance, mount the root volume as a secondary volume, and then revert the changes to the sudoers file.
When you type exit as root, sudo will terminate. Since the exec replaced the user's shell process with sudo , then there's no user shell to which to return.
The easiest way to fix this is with Disk Utility's Repair Disk Permissions feature. Run Disk Utility, select your startup volume in the sidebar, select the First Sid tab, and click Repair Disk Permissions.
And in the future, use the visudo
command to edit the sudoers file to avoid this sort of problem.
Update: the Repair Disk Permissions feature was removed in El Capitain (10.11), because it's (mostly) replaced by System Integrity Protection. If you need to fix the permissions on /etc/sudoers in 10.11 or later, you can do it from AppleScript:
Enter the following script:
do shell script "chown root:wheel /etc/sudoers; chmod 440 /etc/sudoers; chmod -N /etc/sudoers" with administrator privileges
Choose Script menu > Compile (or press Command-K, or click the Compile button in the toolbar). It should colorize the script to indicate the AppleScript syntax. If it reports any errors, make sure you copied the script correctly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With