Sudo giving error after installing homebrew and Laravel Valet
Asked Answered
C

1

7

I had just installed homebrew and afterwards I installed Laravel Valet.
I am now not able to run any sudo commands at all, and it basically broke my computer.

This is the errors I get when running sudo in terminal

>>> /etc/sudoers.d/brew: Alias `BREW' already defined near line 1 <<<
>>> /etc/sudoers.d/valet: Alias `VALET' already defined near line 1 <<<
sudo: parse error in /etc/sudoers.d/brew near line 1
sudo: no valid sudoers sources found, quitting

Any help appreciated

This is my sudoer for /etc/sudoers.d/brew:

Cmnd_Alias BREW = /usr/local/bin/brew *
%admin ALL=(root) NOPASSWD: BREW

And this is my sudoer for /etc/sudoers.d/valet:

Cmnd_Alias VALET = /usr/local/bin/valet *
%admin ALL=(root) NOPASSWD: VALET
Cyprinid answered 20/9, 2016 at 6:6 Comment(0)
J
2

The problem seems when trying to disable password requirement for group admin or users brew and valet. Try to change each sudoers.d file to something as :

Cmnd_Alias BREW = /usr/local/bin/brew *
brew ALL=NOPASSWD: ALL

or in a general way, as inside admin group

Cmnd_Alias BREW = /usr/local/bin/brew *
%admin ALL=NOPASSWD: BREW
Justajustemilieu answered 2/10, 2016 at 11:0 Comment(4)
How do I change the sudoers without sudo access? When I run sudo I just get the errorCyprinid
It didn't work when I changed the sudoers like you wrote.Cyprinid
Had you rebooted? With that sudoers.d file, brew or any user does not need to put sudo password. Could you put here error message that appears to you?Justajustemilieu
Yes I rebooted and the exact errors still came. I made some testing and by just deleting the sudoers.d files I was still able to use homebrew and valet without any problems.Cyprinid

© 2022 - 2024 — McMap. All rights reserved.