I have a script that runs an utility every two days. This utility does some stuff on my system. It is a very known, widely used piece of open source software.
#!/usr/bin/env bash #...do stuff here utility
Sometimes, but not always,
utility will need me to enter my password so it can do its thing. I'm not watching
utility run, and I'm not looking at any output either,
1>/dev/null. So I'd like for any attempt
utility makes to
sudo to automatically fail. Later I can run it manually and see what it needs superuser access for.
The problem is that it's not my script sudoing, it's
utility updates regularly so I don't want to edit it. Setting SUDO_ASKPASS to something useless looked promising but it requires
sudo to have been caled with
utility man page and online docs also don't have a way to "prevent sudo", neither did I have any luck googling "prevent system wide sudo."
I'm thinking of using this
#!/usr/bin/env bash FAKE_SUDO="/usr/local/bin/sudo" echo "echo 'no sudo for you $0' && exit 1" > $FAKE_SUDO chmod u+x $FAKE_SUDO sudo echo "I got superuser access" \rm $FAKE_SUDO
This works because my $PATH has
/usr/local/bin in front of
Do you know a better way to do it?
brew, from the homebrew package manager for macOS, and I'm using
brew upgrade in question. I thought making the question more generic would make it more useful.
$ sudo -V Sudo version 1.8.17p1 Sudoers policy plugin version 1.8.17p1 Sudoers file grammar version 45 Sudoers I/O plugin version 1.8.17p1