Skip to main content
Question

Lost ability to use sudo command


Show first post

34 replies

Forum|alt.badge.img+8
  • Valued Contributor
  • 126 replies
  • August 31, 2020

@kendalljjohnson exactly what we are doing. I have a larger script which looks for any user who have not logged in for a few days and removes them at logout. I just add a few lines below to the script:

if [ -e /Users/root ]
then
rm -rf "/Users/root"
fi

Happy to share the entire script if you like but this is all you need to remove this root issue.... hardest part was trying to work out why it was doing it.....


Forum|alt.badge.img+16

@BOBW We have a similar script running every day looking for accounts that haven't logged in for so many days so just knowing this is how you address it should do the trick. Appreciate the quick response!


Forum|alt.badge.img+12
  • Contributor
  • 158 replies
  • October 30, 2020

Damnit Apple! Latest Supplemental update for 10.14.6 or latest Security update caused the issue again. Entire labs :(


Forum|alt.badge.img+12
  • Contributor
  • 158 replies
  • October 30, 2020

Example


Forum|alt.badge.img+12
  • Contributor
  • 158 replies
  • October 30, 2020

Not conclusive yet, as I just ran a test, running the Security update first and could still do a sudo. Then ran the Supplemental update and thereafter, could still sudo. Computer was a iMac Intel (Retina 5k, 27-inch, Mid 2017). It could be affecting my iMac Intel (Retina 4k, 21.5-Inch, Late 2015) models. Continuing testing


Forum|alt.badge.img+8
  • Valued Contributor
  • 126 replies
  • March 3, 2021

The only way I've found to fix permissions on the shudders file is to run this command:

osascript -e 'do shell script "chown root:wheel /etc/sudoers" with administrator privileges'

It's not possible to modify the owner vi the Finder or Terminal except via AppleScript. I haven't tried running this via a policy yet, only directly on a machine as an Admin user.


Forum|alt.badge.img+1
  • New Contributor
  • 5 replies
  • April 26, 2021

Thanks @jason.bracy - your workaround did the trick for the user I was assisting just now as well.

This was on a Mac running ProductVersion: 11.2.3 BuildVersion: 20D91

The last update installed was the macOS 11.2.3 update.

The error in this case was slightly different, it said:

sudo: /etc/sudoers is owned by uid 1522135644, should be 0 
sudo: no valid sudoers sources found, quitting 
sudo: error initializing audit plugin sudoers_audit

Forum|alt.badge.img+19
  • Valued Contributor
  • 568 replies
  • May 20, 2021

@Martinus We have seen a similar error on 1 specific Mac running 11.3.1 (20E241). We are using AD, but we have added this user to the local admin group and he still sees an error 10% of the time.


Forum|alt.badge.img
  • New Contributor
  • 1 reply
  • May 12, 2023

Here's a new problem on mac running 13.3.1 Ventura. Hope to get help from you guys if it's possible.

sudo: /etc/sudoers is world writable
sudo: no valid sudoers sources found, quitting
sudo: error initializing audit plugin sudoers_audit

Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings