"sudo: can't open /private/etc/sudoers: permission denied"

I have been running Ascentemu. Dont ask what it is, its just cool.

I compiled it myself...

Anyways, to run it I type:
sudo sh ascent.sh
sudo sh logonserver.sh

But when I do that i get:
"sudo: can't open /private/etc/sudoers: permission denied"

I repaired permissions but it did not help...
I made sure it is 0440 (read only for system and wheel)...

Please help!!
Sully

Mac Mini, Mac OS X (10.5.1), 1 External HD, 150 GB, iPod Touch 8GB

Posted on Jan 18, 2008 2:58 PM

Reply
35 replies

Jan 24, 2008 4:32 PM in response to RSully

Did you happen to change anything with your pam configuration in /private/etc/pam.d/sudo or Directory services / authentication or such? This machine isn't bound to LDAP or ActiveDirectory or something is it? This is just something else I thought of that may be causing trouble....

Post the output of these....

ls -lh@Oe /private/etc/pam.d
cat /private/etc/pam.d/sudo

Mine reads like this, fwiw.......

new-host-2:pam.d sean$ ls -lhO@e /private/etc/pam.d
total 88
-r--r--r-- 1 root wheel - 102B Sep 23 20:53 chkpasswd
-rw-r--r-- 1 root wheel - 280B Sep 28 23:49 cups
-rw-r--r-- 1 root wheel - 243B Sep 23 22:29 ftpd
-r--r--r-- 1 root wheel - 362B Sep 23 20:53 login
-r--r--r-- 1 root wheel - 191B Sep 23 20:53 other
-r--r--r-- 1 root wheel - 185B Sep 23 20:53 passwd
-r--r--r-- 1 root wheel - 141B Sep 23 20:53 samba
-r--r--r-- 1 root wheel - 403B Sep 23 20:53 sshd
-r--r--r-- 1 root wheel - 449B Sep 23 20:53 sshd.serverinstall
-r--r--r-- 1 root wheel - 343B Sep 23 20:53 su
-r--r--r-- 1 root wheel - 280B Sep 23 20:53 sudo

new-host-2:pam.d sean$ cat /private/etc/pam.d/sudo
# sudo: auth account password session
auth sufficient pam_securityserver.so
auth sufficient pam_unix.so
auth required pam_deny.so
account required pam_permit.so
password required pam_deny.so
session required pam_permit.so

Jan 24, 2008 4:43 PM in response to brainslice

Sully:~ ryansully11$ ls -lh@Oe /private/etc/pam.d
total 88
-r--r--r-- 1 root wheel - 102B Sep 23 20:53 chkpasswd
-rw-r--r-- 1 root wheel - 280B Sep 28 23:49 cups
-rw-r--r-- 1 root wheel - 243B Sep 23 22:29 ftpd
-r--r--r-- 1 root wheel - 362B Sep 23 20:53 login
-r--r--r-- 1 root wheel - 191B Sep 23 20:53 other
-r--r--r-- 1 root wheel - 185B Sep 23 20:53 passwd
-r--r--r-- 1 root wheel - 141B Sep 23 20:53 samba
-r--r--r-- 1 root wheel - 403B Sep 23 20:53 sshd
-r--r--r-- 1 root wheel - 449B Sep 23 20:53 sshd.serverinstall
-r--r--r-- 1 root wheel - 343B Sep 23 20:53 su
-r--r--r-- 1 root wheel - 280B Sep 23 20:53 sudo
Sully:~ ryansully11$ cat /private/etc/pam.d/sudo
# sudo: auth account password session
auth sufficient pam_securityserver.so
auth sufficient pam_unix.so
auth required pam_deny.so
account required pam_permit.so
password required pam_deny.so
session required pam_permit.so
Sully:~ ryansully11$


so?

also, i used Pacifist and searched for "sudo" about 8 files came up-- i installed them...

Feb 29, 2008 4:16 PM in response to RSully

You mentioned that you don't want to enable the root account for security reasons. You can enable it and then turn it back off:

How to enable the root user
Mac OS X 10.5 or later

From the Finder's Go menu, choose Utilities.
Open Directory Utility.
Click the lock in the Directory Utility window.
Enter an administrator account name and password, then click OK.
Choose Enable Root User from the Edit menu
Enter the root password you wish to use in both the Password and Verify fields, then click OK.

How to disable the root user
Mac OS X 10.5 or later

Click the Finder icon in the Dock.
From the Go menu, choose Utilities.
Open Directory Utility.
Click the lock in the Directory Utility window.
Enter an administrator account name and password, then click OK.
Choose Disable Root User from the Edit menu.

Message was edited by: BillC37

Mar 5, 2008 1:38 PM in response to RSully

Do you mean you have been running +sudo su+? If so, that will essentially run whatever commands that come after that as if you had put sudo in front of it. It makes that Terminal session run as root. You shouldn't need to do that. Very dangerous...

As for your 10.5.2 update issue, post the link to the thread you wrote up about it and I'll take a look.

Mar 5, 2008 10:44 PM in response to RSully

Keep in mind, permission problems can be the file itself, such as /private/etc/sudoers, or anything above the file, such as the /, /private, or /private/etc directories themselves.

I just solved this exact problem for a user at macrumors, and it was ultimately the group permissions on / itelf!

Here's what the perms should look like
$ ls -lad / /private /private/etc
drwxrwxr-t@ 32 root admin 1156 Feb 18 15:07 /
drwxr-xr-x@ 6 root wheel 204 Nov 29 22:15 /private
drwxr-xr-x 87 root wheel 2958 Feb 19 19:27 /private/etc

in his case, the root directory was:
drwx---rwx+ 33 root admin 1190 Feb 14 23:38 /

Since sudo access isn't available, it's not surprising that commands that need to run as root (such as diskutil repairpermissions) would not work properly. To fix this, you must get root authority and fix the appropriate permission. Without access to sudo, single user mode is the most straightforward way to do this:

Reboot into single user mode (hold Option S while booting until it switches to text mode)

At the single user prompt, type: /sbin/fsck -fy

This checks the filesystem integrity

Then type: /sbin/mount -wu /

This mounts the root filesystem as read/writable.

Next correct the broken directory permission. For the example above, it was the perms for /, therefore:

Next type: /bin/chmod 1775 /

Type: /bin/sync

This will make sure the change is written to the filesystem.

Type: exit

Your mac will continue booting as normal and life should be good! sudo should now work. At this point, I'd recommend a repair permissions in Disk Utility to correct anything else that may not be right.

Mar 6, 2008 11:21 AM in response to goatGotten

this seems like the most helpful.. this is what happen:

Sully:~ ryansully11$ ls -lad / /private /private/etc
drwx---r-x@ 38 root admin 1360 Feb 7 12:02 /
drwxr-xr-x@ 6 root wheel 204 Dec 8 21:14 /private
drwxr-xr-x 106 root wheel 3604 Mar 5 19:32 /private/etc
Sully:~ ryansully11$


so I think that your solution will help, I would rather do this with you on iChat or MSN so I dont mess up..

if you got iChat then that would work best...

thanks
ryan

Mar 6, 2008 11:32 AM in response to RSully

Hmm, so it's the exact same permission problem as the guy on macrumors. Interesting coincidence, wonder if there's a common cause.

Anyway, no need for iChat or anything, just do the following and you're done!

Reboot into single user mode (hold Option S while booting until it switches to text mode)

Once it's stopped at a prompt, type each of these commands in turn. Some of them will return immediately to the prompt without output but they are still working:

/sbin/fsck -fy
/sbin/mount -wu /
/bin/chmod 1775 /
/bin/sync
exit

Let us know how it goes!

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

"sudo: can't open /private/etc/sudoers: permission denied"

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