Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"/etc/sudoers is world writable" on Mac OS X Mavericks

Currently, I am working on an OSX Maverick, and I can't use sudo command in Terminal.


My-Mac:~ phucnd$ sudo

sudo: /etc/sudoers is world writable

sudo: no valid sudoers sources found, quitting.

How can i fix it ?

like image 588
s7ven Avatar asked Nov 19 '13 14:11

s7ven


People also ask

How do I open etc sudoers on Mac?

Open up your finder and go to /etc . In here, you can view the details of the sudoers file, including permissions - screenshot below. Change the permissions for "everyone" here to Read & Write. At this time, you can edit yourself back into the file with any text editor.

Where is etc sudoers in Mac?

The Sudoers file is located at / etc / sudoers, but unlike / etc / hosts and many other system configuration files, you do not want to point to a generic text editor to edit the file. Instead, you want to use a specific command called 'visudo' that validates the correct syntax before saving the document.


1 Answers

1.Enable root user:
System Preferences -> Users&Groups -> Login options -> Network Account Server -> Join -> Open Directory Utility -> Edit(menu) -> Enable Root User

2.switch to root,change /etc/sudoers permissions
$su
$chmod 440 /etc/sudoers

like image 67
Marx Yu Avatar answered Sep 23 '22 14:09

Marx Yu