Sudo already tells the user when access is denied:
[jayman@this-machine:~]$ sudo echo hi [sudo] password for jayman: Sorry, try again. [sudo] password for jayman: Sorry, try again. [sudo] password for jayman: sudo: 3 incorrect password attempts [git@this-machine:~]$ sudo echo hi Sorry, user git may not run sudo on this-machine. Sudo doesn’t, however, tell the user when access has been granted. Consider what happens when sudo dd if=foo of=bar gets run. For me, one of two things happens:
- Sudo prompts me for a password. I enter the password and see the terminal go to the next line, but
dddoesn’t output anything for a while. I end up waiting a few seconds to make sure that Sudo isn’t waiting to say “Sorry, try again” and prompt me for the password again. - Sudo doesn’t prompt me for a password because my credentials are cached.
dddoesn’t output anything for a while. I end up waiting a few seconds to make sure that Sudo isn’t just taking a while to prompt me for a password.
If Sudo printed a message after my password was accepted, then I wouldn’t have to wait to figure out whether or not dd had started yet. Is there any way to get Sudo to print a message when access has been granted?