Friday, July 21, 2017

sudo: /etc/sudoers is world writable

How to solve error message on terminal when you execute command with sudo on Mac


1. Open terminal and make a copy of sudoers file

cp /etc/sudoers /etc/sudoers.bck

2. Check the current permissions

ls -l /etc/sudoe*

result:
-rwxrwxrwx+ 1 root wheel 1563 Jul 17 11:07 /etc/sudoers



3. 
Write su and after prompt put the administrator password
su

4. Change the permissions of file to -r--r---- using the command 

chmod 440 /etc/sudoers

5. Exit su 

exit

6. Check again the permissions

ls -l /etc/sudoe*

result:
-r--r-----+ 1 root wheel 1563 Jul 17 11:07 /etc/sudoers

No comments :

Post a Comment