Saturday, March 20, 2010

sudo: must be setuid root - MAC OSX

As soon as i discovered Snow Leopard had built-in PHP and Apache, i immediately tinkered around with config files through the vi editor which i haven't used in 10 years. Being mostly a .NET developer, it was a pain using the terminal window to set permissions on folders and files. I discovered that you could configure your Finder to display hidden folders such as etc and usr by typing this on the terminal window:

defaults write com.apple.finder AppleShowAllFiles -bool true

Seeing all the hidden folders and files on the Finder window made me so excited that the first thing i did was Add myself to have Read/Write permissions on the etc and usr folders. The next thing i did got me into trouble. I clicked on "Apply to Enclosed Items" which cascaded the change to all files and subfolders under etc and usr.

After doing this, i tried restarting Apache by typing this on the terminal window:

sudo /usr/sbin/apachectl restart

and that's when I started seeing this message:

sudo: must be setuid root

I exited the Terminal Window and re-opened it and now I was even getting this error:

login: PAM Error (line 396): System error
login: Could not determine audit condition

[Process completed]


After googling solutions to this problem, i found the fix which was to delete the file
/usr/bin/login and after that I was able to use Terminal window again.

Now going back to the original problem which was finding a fix for sudo: must be setuid root, I went to Utilities -> Disk Utility and selected my Hard drive, Macintosh HD. I clicked Repair Disk Permissions and everything seems to be working again.

Hope this helped anyone who ran into this problem.

18 comments:

  1. thanks.... you saved my day :)

    ReplyDelete
  2. thank-you good sir, saved my day as well!

    ReplyDelete
  3. Thanks a lot mate, it worked!

    ReplyDelete
  4. Very nice .. fwiw, I was able to run repair disk permission without having to delete said login file or logout of terminal and it work

    ReplyDelete
  5. Whoohoo! Saved my posterior - thanks much.

    ReplyDelete
  6. Thank you so much!! Been bothering me for months!

    ReplyDelete
  7. Thank you sir !

    ReplyDelete
  8. Thank you so much !! I was dying there !

    ReplyDelete
  9. Good man. Sorted my problem out too.

    ReplyDelete
  10. You are a lifesaver.

    ReplyDelete
  11. Thank you, lifesaver

    ReplyDelete