4 ms·
If you're concerned that a script's root password prompt may be a forgery, you can run "sudo -v" before executing the script. For background, there is a conven
by majewsky 6y ago
If you're concerned that a script's root password prompt may be a forgery, you can run "sudo -v" before executing the script.
For background, there is a convenience feature in sudo: It only requires your password prompt if you have not had a successful sudo invocation in the same terminal in the last X minutes (5 minutes, I think? not sure on the exact value). "sudo -v" is a special invocation which does not actually execute any command, but it renews your 5-minute lease. ("sudo true" is effectively equivalent, though not idiomatic.)
So if you're executing a short script that needs sudo, run "sudo -v" before running the actual script. Then you know that if a root password prompt pops up again, it's not really sudo who's asking.
- gruez 6y ago> If you're concerned that a script's root password prompt may be a forgery, you can run "sudo -v" before executing the script. The bigger problem is that even without sudo or your root password, malicious scripts can do a lot of damage. ie. they can add a fake sudo to your .profile, so you next time you try to do "sudo -v" your password still gets stolen.