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

sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set

Hello, I messed up with permissions somehow, may anybody please clarify for me how to run back that, when I run these commands, I get the next


Air-Anastasia:bereshka$ which sudo

/usr/bin/sudo

Air-Anastasia:bereshka$ echo $PATH

/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

Air-Anastasia:bereshka$ ls -l /usr/bin/sudo

-rwxr-xr-x 1 root wheel 370704 May 29 18:36 /usr/bin/sudo

MacBook Air, iOS 10.1

Posted on Jul 1, 2018 8:34 PM

Reply
Question marked as Best reply

Posted on Jul 2, 2018 6:16 PM

Re-install is the easy option.


But if you want to play around in Recover mode, you could try that. You would have to mount the boot partition read/write and then navigate to the sudo file on the mounted boot partition, which would be something like


cd /Volumes/<boot_partition_name>/usr/bin/

chmod 4511 sudo


If that doesn't work, then booting into single user mode might do it

Boot holding Command-S

When you get the command prompt


mount -uw /

chmod 4511 /usr/bin/sudo

exit

8 replies
Question marked as Best reply

Jul 2, 2018 6:16 PM in response to Bereshka

Re-install is the easy option.


But if you want to play around in Recover mode, you could try that. You would have to mount the boot partition read/write and then navigate to the sudo file on the mounted boot partition, which would be something like


cd /Volumes/<boot_partition_name>/usr/bin/

chmod 4511 sudo


If that doesn't work, then booting into single user mode might do it

Boot holding Command-S

When you get the command prompt


mount -uw /

chmod 4511 /usr/bin/sudo

exit

Jul 2, 2018 6:21 AM in response to Bereshka

/bin/ls -leO@ /usr/bin/sudo

-r-s--x--x 1 root wheel restricted,compressed 369648 Jul 15 2017 /usr/bin/sudo


You will need to be the 'root' to use this command. Normally you would use 'sudo' but you broke that.

chmod 4511 /usr/bin/sudo


You could just re-install macOS over top of the existing install. That should put things back the way they belong.


You could boot into Recovery mode, and start a Terminal session from the Recovery menu, then mount the real boot partition read/write, then issue the above command including the /Volume/boot_device_name/usr/bin/sudo as the path.


And if you broke the 'sudo' command, did you also brake the /private/etc/sudoers file's permissions as well?

/bin/ls -leO@ /private/etc/sudoers

-r--r----- 1 root wheel - 2299 Jan 11 09:06 /private/etc/sudoers


No sense going to all the trouble to fix sudo, and still have a broken sudoers file.

Jul 2, 2018 5:51 PM in response to BobHarris

Hello,

Thank you for your wish to help, as far only re-install I found as an option in the internet and any other options what people offer is for ubuntu, but not so much for OS.

So when I do

/bin/ls -leO@ /usr/bin/sudo

-rwxr-xr-x 1 root wheel restricted,compressed 370704 May 29 18:36 /usr/bin/sudo

and here is the second line

/bin/ls -leO@ /private/etc/sudoers

-r--r----- 1 root wheel compressed 2299 Aug 22 2015 /private/etc/sudoers

Do you still think there is only one option is to re-install?

Jul 2, 2018 7:48 PM in response to BobHarris

the easy option)) I have bunch of programs, I will need to install that too, also to import ssh keys and other, to set all email accounts... I should have a backup if my 3 yrs old would not threw out the HD)


Thank you, I will try this Recovery mode and if that doesn't work, I will re-install! thanks a lot

I will post a reply about wether it's successfully done)

sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set

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