Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.
dvd - you are a God!

Thanks dvd, you saved my Mac from certain destruction. I ran into this problem after typing the following command in Terminal;

sudo chmod g-x /

I read on 2 separate forums that this was the way to allow the built-in sendmail (php) function to run for my web site and that's when things went belly up!

I guess I must have done something silly to that folder as I could not longer sudo but now thanks to you it's fixed! (^_^)

Thanks again!
 
Can't do it in my iMac

Now we're getting somewhere!

Reboot into single user mode (hold Option S while booting until it switches to text mode)

At the single user prompt, type: /sbin/fsck -fy

This checks the filesystem integrity

Then type: /sbin/mount -wu /

This mounts the root filesystem as read/writable.

Next type: /bin/chmod 1775 /

This will correct the permissions for your / directory

Type: /bin/sync

This will make sure the change is written to the filesystem

Type: exit

Your mac will continue booting as normal and life should be good! Sudo should work. At this point, do a repair permissions to correct anything else that may not be right. The repair permissions probably does not work right now because you can't get admin authority due to the incorrect permissions.

This is pretty good work, but for me that dint work sine my iMac keyboard is wireless and when ire boot it nothing happen 'cause by the time is finish rebooting then it search for the keyboard, what do you suggest i should do?
 
It worked!!

Thanks dvd! It's an honor to have patient, helpful, and knowledgeable people like you in the Mac community :)

P.S. After the fix, Repair Permissions found nothing to repair (other than the standard 3 ACL issues).

Hopefully others having this issue will be better able to track down their permissions problem now.

Worked for me too. You saved me dvd! I was configuring a new Mac for my wife and I ran into the sudo command problem.

The install for Adobe Reader would get stuck over and over again and I would have to force quit. When I went into console messages, it was encountering errors on the sudo command.

Followed your instructions, tested the sudo command in Terminal and it worked again. Reran the Adobe software install and it went smooth as can be.

I think it was something you mentioned in one of your posts that caused the problem. When I was messing with sharing, I think, at one point, I shared the entire drive.

Thank you for saving me!!!!
 
The permissions for the file were fine, let's check the parent directories:

ls -lad /private/etc /private

Should result in:
drwxr-xr-x@ 6 root wheel 204 Nov 29 22:15 /private
drwxr-xr-x 87 root wheel 2958 Feb 19 19:27 /private/etc

Oh and while you're at it, do a:

ls -la /usr/bin/sudo

-r-s--x--x 1 root wheel 211232 Sep 23 19:29 /usr/bin/sudo

PS, it's the admin group that you need to be in to use sudo, not wheel:
sudo grep admin /private/etc/sudoers
%admin ALL=(ALL) ALL[/QUOTE]
----------------------------------------------
First I'd like to thank you in advance;
I having issues restoring a jailbroken Iphone using Itunes, I get this msg "The Iphone "" could not be restored. This device isn't eligible for the requested build." Anyway, I was redirected to erase two lines from a file (etc) in the (private) folder, which apparently I don't have sufficient access privileges to do. I open terminal to do some SUDO chmod as usual, and I get this msg
"sudo: can't open /private/etc/sudoers: Permission denied" even though I'd been using sudo for quite a while. I know you've had this discussion with {Amigalander}, but when I type: [ls -laa /user/bin/sudo] I am getting
*ls: illegal option -- /
usage: ls [-ABCFGHLPRSTWabcdefghiklmnopqrstuwx1] [file ...]*

To be honest I still don't know for sure whether I'm the absolute administrator. It does say that in the System Preferences/Accounts, but I have my doubts LOL.. And to make things even more complicated for you, I don't really know what my question is, but please help!!
Thank you so much for your time. Here's the link to your discussion with Amigalander
https://forums.macrumors.com/threads/447812/
 
Just wanted to post saying I had the same problem with my Lion install and this fix worked for me too.
 
Now we're getting somewhere!

Reboot into single user mode (hold Option S while booting until it switches to text mode)

At the single user prompt, type: /sbin/fsck -fy

This checks the filesystem integrity

Then type: /sbin/mount -wu /

This mounts the root filesystem as read/writable.

Next type: /bin/chmod 1775 /

This will correct the permissions for your / directory

Type: /bin/sync

This will make sure the change is written to the filesystem

Type: exit

Your mac will continue booting as normal and life should be good! Sudo should work. At this point, do a repair permissions to correct anything else that may not be right. The repair permissions probably does not work right now because you can't get admin authority due to the incorrect permissions.


This worked for me, just wanted to say thanks!
 
Thank you!!!

All of sudden sudo permission denied and this fixed it. A big thank you.

Now we're getting somewhere!

Reboot into single user mode (hold Option S while booting until it switches to text mode)

At the single user prompt, type: /sbin/fsck -fy

This checks the filesystem integrity

Then type: /sbin/mount -wu /

This mounts the root filesystem as read/writable.

Next type: /bin/chmod 1775 /

This will correct the permissions for your / directory

Type: /bin/sync

This will make sure the change is written to the filesystem

Type: exit

Your mac will continue booting as normal and life should be good! Sudo should work. At this point, do a repair permissions to correct anything else that may not be right. The repair permissions probably does not work right now because you can't get admin authority due to the incorrect permissions.
 
Now we're getting somewhere!

Reboot into single user mode (hold Option S while booting until it switches to text mode)

At the single user prompt, type: /sbin/fsck -fy

This checks the filesystem integrity

Then type: /sbin/mount -wu /

This mounts the root filesystem as read/writable.

Next type: /bin/chmod 1775 /

This will correct the permissions for your / directory

Type: /bin/sync

This will make sure the change is written to the filesystem

Type: exit

Your mac will continue booting as normal and life should be good! Sudo should work. At this point, do a repair permissions to correct anything else that may not be right. The repair permissions probably does not work right now because you can't get admin authority due to the incorrect permissions.

Ancient thread I know but I just wanted to let anybody know that this works in Yosemite too. No idea why but my permissions were mucked up too and I was not able to run a sudo command, running these commands fixed it.

Just a tip. You can't enter single user mode whilst you have a firmware password enabled, disable it via your Recovery partition first. Single user mode is accessed via [CMD]+ S. Source:- https://support.apple.com/en-gb/HT201573
 
Last edited:
Ouch, I'm a bit stumped. Googling around, it appears you aren't the first to have this happen to them. No clear fixes, though, other than to perform an Archive and Install, which seems a bit extreme.

Just to bottom out on the obvious permissions path, let's make sure / is okay:

$ ls -lad /
drwxrwxr-t@ 32 root admin 1156 Feb 18 15:07 /

I've been having the same problem, and after changing the permissions to match these, my only discrepancy is that my output is:
$ ls -lad /
drwxrwxr-t 33 root wheel 1190 Feb 5 12:01 /

could it be my problem that wheel is listed instead of admin?
Thanks
[doublepost=1454703807][/doublepost]
I've been having the same problem, and after changing the permissions to match these, my only discrepancy is that my output is:
$ ls -lad /
drwxrwxr-t 33 root wheel 1190 Feb 5 12:01 /

could it be my problem that wheel is listed instead of admin?
Thanks



update: It turned out to be an issue with me beating my head against an invisible wall, aka El Capitans "System Integrity Protection". It's resolve by this reboot in recovery mode method http://stackoverflow.com/questions/...ed-in-os-x-el-capitan-10-11/32590885#32590885
 
Ouch, I'm a bit stumped. Googling around, it appears you aren't the first to have this happen to them. No clear fixes, though, other than to perform an Archive and Install, which seems a bit extreme.

Just to bottom out on the obvious permissions path, let's make sure / is okay:

$ ls -lad /
drwxrwxr-t@ 32 root admin 1156 Feb 18 15:07 /

with El Capitan it's

ls -l /Users

hope this helps
 
Now we're getting somewhere!

Reboot into single user mode (hold Option S while booting until it switches to text mode)

At the single user prompt, type: /sbin/fsck -fy

This checks the filesystem integrity

Then type: /sbin/mount -wu /

This mounts the root filesystem as read/writable.

Next type: /bin/chmod 1775 /

This will correct the permissions for your / directory

Type: /bin/sync

This will make sure the change is written to the filesystem

Type: exit

Your mac will continue booting as normal and life should be good! Sudo should work. At this point, do a repair permissions to correct anything else that may not be right. The repair permissions probably does not work right now because you can't get admin authority due to the incorrect permissions.

Ancient thread I know but I just wanted to let anybody know that this works in Yosemite too. No idea why but my permissions were mucked up too and I was not able to run a sudo command, running these commands fixed it.

Just a tip. You can't enter single user mode whilst you have a firmware password enabled, disable it via your Recovery partition first. Single user mode is accessed via [CMD]+, not [OPT]+. Source:- https://support.apple.com/en-gb/HT201573

It happened to me again. DVDs method fixed it again (along with my additional notes). Still works under macOS Sierra 10.12.3.
 
I don't think this is a group problem, I think it's a problem accessing the /private/etc/sudoers file itself. I'm not in the wheel group and sudo works fine for me. And your 'id' output shows that your account is already set up as an administrator.

The permissions for the file were fine, let's check the parent directories:

ls -lad /private/etc /private

Should result in:
drwxr-xr-x@ 6 root wheel 204 Nov 29 22:15 /private
drwxr-xr-x 87 root wheel 2958 Feb 19 19:27 /private/etc

Oh and while you're at it, do a:

ls -la /usr/bin/sudo

-r-s--x--x 1 root wheel 211232 Sep 23 19:29 /usr/bin/sudo

PS, it's the admin group that you need to be in to use sudo, not wheel:
sudo grep admin /private/etc/sudoers
%admin ALL=(ALL) ALL

----------------------------------------question---------------------------------------------

Hi DVD/ Other Mac people,
I've been trying to remove the Active Directory settings in my mac but I don't have the permission even though I am the owner/dministrator.

I tried the reboot option with /sbin/fsxk -fy but was ignored.
Can someone help me in my computer?


localhost:/root#/sbin fsck -fy
warning : option -f is not implemented, ignoring
**checking container superblock
**checking space manager
**checking the space manager queue trees
**checking the object map.
**checking volume.
**Checking APFS volume superblock
**The volume Lalamari was formatted by hfs_convert(748.77.8) and last modified by apfs_kext(945.275.7).
**Checking object map.
handle_crypto_mount:831:handling crypto mount (volume /dev/disk1s1)
handle_crypto_mount:1050:crypto mount finished w/apfs
**Checking snapshot metadata tree.
** Checking snapshot metadata.
**Checking extent ref tree.
**Checking the fsroot tree.
apfs_vfsop_unmount:1636: fake mount for going away
apfs: total mem allocated: 2058966 (2mb);
** Verifying allocated space.
**The volume /dev/rdisk1s1 appears to be OK.


I've tried the -la / usr/bin//sudo
result:
-r-s--x--x 1 root wheel 370720 July30 05:56 /usr/bin/sudo

Can someone help and explain the above lines?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.