[Note: This is for OS X 10.8 Mountain Lion since 10.9 Mavericks is incompatible with apps I use daily.]
I've been a unix admin since the 80's, moving around between BSD, linux and the rest of them. I'm a command line junkie. I have a few Macs and they've always been good to me, but something odd is gnawing at me. Last year, I received an update and then I wasn't allowed to sudo anymore.
$ sudo
sudo: can't open /private/etc/sudoers: Permission denied
sudo: no valid sudoers sources found, quitting
I couldn't believe it was an update that did this, so I was going to try this:
Reboot, Opt-S
/sbin/fsck -fy
/sbin/mount -wu /
/bin/chmod 1775 /
/bin/sync
exit
but single user mode doesn't work for me. At all. Pressing Opt-S seems to be ignored.
And this isn't just one one Mac, I have an Air, two MBPs, two Minis, one Pro 4,1... I can't get this to work on any of these systems. So, i decided to wipe the drives and reinstall OS X clean.
I still get the same error as above. No access to sudo at all. And this is after I never installed a single app or even connected it to a network. A fresh install doesn't allow me, the admin, installer, any root access. Trying to 'passwd root' gets me nowhere.
Here's the research I found:
$ ls -la /private/etc/sudoers
-r--r----- 1 root wheel 1275 Apr 24 2013 /private/etc/sudoers
$ sudo dscl . -append /Groups/wheel GroupMembership MyUserName
-bash: $: command not found
$ ls -lad /private/etc /private
drwxr-xr-x@ 6 root wheel 204 Apr 24 2013 /private
drwxr-xr-x 101 root wheel 3434 Jun 6 12:11 /private/etc
$ ls -la /usr/bin/sudo
-r-s--x--x 1 root wheel 164496 Sep 19 2013 /usr/bin/sudo (Here, the '/usr/bin/sudo' is highlighted red in the terminal.)
$ sudo grep admin /private/etc/sudoers
sudo: can't open /private/etc/sudoers: Permission denied
sudo: no valid sudoers sources found, quitting
ls -lad /
drwx---rwx+ 39 root wheel 1394 Jun 6 12:12 / (The '/' is highlighted in yellow)
$ ls -alO /Volumes
total 8
drwxrwxrwt@ 5 root admin hidden 170 Jun 6 12:12 .
drwx---rwx+ 39 root wheel - 1394 Jun 6 12:12 .. (The '..' is highlighted in yellow)
lrwxr-xr-x 1 root admin - 1 Jun 6 12:12 Macintosh HD -> /
drwxrwxr-x 12 MyUserName staff - 476 Apr 22 15:11 [TimeMachineBackup]
drwxrwxr-x 22 MyUserName staff - 816 May 12 12:21 [External Raid5 array]
This, to me is straightforward and self-explanatory in any normal circumstance, but there's something here I'm missing and I can't identify it. Any assistance would be greatly appreciated.
I've been a unix admin since the 80's, moving around between BSD, linux and the rest of them. I'm a command line junkie. I have a few Macs and they've always been good to me, but something odd is gnawing at me. Last year, I received an update and then I wasn't allowed to sudo anymore.
$ sudo
sudo: can't open /private/etc/sudoers: Permission denied
sudo: no valid sudoers sources found, quitting
I couldn't believe it was an update that did this, so I was going to try this:
Reboot, Opt-S
/sbin/fsck -fy
/sbin/mount -wu /
/bin/chmod 1775 /
/bin/sync
exit
but single user mode doesn't work for me. At all. Pressing Opt-S seems to be ignored.
And this isn't just one one Mac, I have an Air, two MBPs, two Minis, one Pro 4,1... I can't get this to work on any of these systems. So, i decided to wipe the drives and reinstall OS X clean.
I still get the same error as above. No access to sudo at all. And this is after I never installed a single app or even connected it to a network. A fresh install doesn't allow me, the admin, installer, any root access. Trying to 'passwd root' gets me nowhere.
Here's the research I found:
$ ls -la /private/etc/sudoers
-r--r----- 1 root wheel 1275 Apr 24 2013 /private/etc/sudoers
$ sudo dscl . -append /Groups/wheel GroupMembership MyUserName
-bash: $: command not found
$ ls -lad /private/etc /private
drwxr-xr-x@ 6 root wheel 204 Apr 24 2013 /private
drwxr-xr-x 101 root wheel 3434 Jun 6 12:11 /private/etc
$ ls -la /usr/bin/sudo
-r-s--x--x 1 root wheel 164496 Sep 19 2013 /usr/bin/sudo (Here, the '/usr/bin/sudo' is highlighted red in the terminal.)
$ sudo grep admin /private/etc/sudoers
sudo: can't open /private/etc/sudoers: Permission denied
sudo: no valid sudoers sources found, quitting
ls -lad /
drwx---rwx+ 39 root wheel 1394 Jun 6 12:12 / (The '/' is highlighted in yellow)
$ ls -alO /Volumes
total 8
drwxrwxrwt@ 5 root admin hidden 170 Jun 6 12:12 .
drwx---rwx+ 39 root wheel - 1394 Jun 6 12:12 .. (The '..' is highlighted in yellow)
lrwxr-xr-x 1 root admin - 1 Jun 6 12:12 Macintosh HD -> /
drwxrwxr-x 12 MyUserName staff - 476 Apr 22 15:11 [TimeMachineBackup]
drwxrwxr-x 22 MyUserName staff - 816 May 12 12:21 [External Raid5 array]
This, to me is straightforward and self-explanatory in any normal circumstance, but there's something here I'm missing and I can't identify it. Any assistance would be greatly appreciated.