1

When I'm done with making Ubuntu remember my password and do not ask for it before risky actions...

Is there a way to get safe pop up confirmation window (without password input, just OK or cancel)?

So I will know when a pesky program runs a risky action that I don't want to proceed?

Or it is not developed since the program could just simulate a click on OK anyway?

kiri
  • 28,246
  • 16
  • 81
  • 118
Esamo
  • 1,522
  • 2
  • 16
  • 28

2 Answers2

1

No, there is no way to do this. If you enable sudo without a password (How to run sudo command with no password?), then any process you run can execute sudo and run code as root without any confirmation.

bain
  • 11,260
-1

Let's write a small program for that:

Create /usr/local/bin/sudo:

#!/bin/sh
read -p "You sure you want to run sudo? " ans
case "$ans" in
y|Y|[yY][eE][sS]) ;;
*) exit ;;
esac
exec /bin/sudo "$@"

You could also create it in a temporary directory, add that directory to path before running that "pesky program". It's not 100% fullproff, but should handle most common cases.

  • 2
    Writing a script to replace the base sudo system, while it works, is not recommended because sudo is called from a LOT of other scripts and such without the full path - this will likely interfere with any other systems, programs, scripts, etc. calling sudo. – Thomas Ward Dec 29 '20 at 15:30