-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sudo
not working anymore after running any brew
command
#17915
Comments
This is intentional, WONTFIX and a duplicate of #17905 |
Is there a command to prevent this from happening? |
Not really a single command, but I mitigated the issue by adding a custom #!/usr/bin/bash
faketty() {
script -qefc "$(printf "%q " "$@")" /dev/null
}
faketty "/home/linuxbrew/.linuxbrew/bin/brew" "$@" Add this file to This only works, if
Alternatively, a file with this content can be placed in This is definitely more of a dirty workaround, but works for my case. |
Note that:
And while I use the word "hack", it's really the logical solution to isolate any command that resets |
Yes! I happened to find a similar way which worked on my system, my system doesn't come with visudo so I'm not keen to touch the
Would you class this as dirty? Let me know :) |
The Your hack suppresses all credential checks, so any formula/cask (in fact, any code It's really not the same principle. At all.
Yes. Potentially catastrophic? Also yes. |
It's only really active in that state for 3-4 minutes where sudo just doesn't cache. The trap removes the privilege instantly on |
Okay this might be better but would like advice...
I'm missing what the catastrophic issue is. The installation script only has this access for a very carefully planned install list. It can only run if you have root initially so sudo -v is cached. Okay so it's not the same thing as timestamp. But I've set the trap for exit. And even during the script I'm deleting |
You've only posted the script preamble, so everyone reading it has to expect the worst: that it's a generic script with no restrictions.
Use the Bottom line: Homebrew maintainers deliberately quashed As you might guess, I'd never ever run something like this, but in the end, it's your box, your rules...your consequences. |
See https://brew.sh/2024/07/30/homebrew-security-audit/ for the now disclosed reasons 😁. Locking this. Please feel free to continue any discussion in Homebrew/discussions. |
brew doctor
outputVerification
brew doctor
output" above saysYour system is ready to brew.
and am still able to reproduce my issue.brew update
twice and am still able to reproduce my issue.brew install wget
. If they do, open an issue at https://github.com/Homebrew/homebrew-core/issues/new/choose instead.brew config
outputWhat were you trying to do (and why)?
Running
brew
commands inside scripts that also contain other commands run with sudo. This is part of my system setup/update process, so I only have to run one command to update everything.The issue is also reproducible outside any custom script by checking sudo privileges after running any
brew
command.What happened (include all command output)?
After running any
brew
command, previous sudo privileges are lost.It seems like the
brew info
command can be replace with any other brew command. I tried:brew info
brew install
brew help
brew doctor
brew config
NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
What did you expect to happen?
I expected the already granted sudo privileges to stay and be reusable for following commands.
I strongly suspect #17694 to be the cause of this problem, as it only popped up after I made a recent update to homebrew. Maybe there is another way to revoke sudo permissions for the formula only, without it affecting the parent environment?
Step-by-step reproduction instructions (by running
brew
commands)The text was updated successfully, but these errors were encountered: