2

The title says it all. How can I configure sudo to prompt for password and show the executed command?

Rationale: if something gets aliased in the shell or I end up executing a function sudo instead of the program, I would still like to see the actual sudo (i.e. /usr/bin/sudo on Ubuntu) is going to execute before I do it. This is mostly for security reasons, i.e. I would configure this only for certain types of impersonation via sudo.

Bonus points: if this can be configured, is it also possible to use it with NOPASSWD: inside /etc/sudoers?

  • It appears that the default action is to write the command to /var/log/auth.log. So you could write a bash function to parse the last sudo command by your UID. Downside is that you have to be a member of the adm group to view the auth.log file. Probably an enhancement request to the package maintainer. – Justin Andrusk Jun 11 '13 at 2:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.