Sometimes it amazes me the "little" things I don't know about Unix. For years now I have occasionally noted that I don't actually know how to deal with the sudo password prompt cleanly. Every once in a while I sudo something only to realize that I don't actually want to run the command at all. This happens rarely enough I always forget to ask but just often enough that I remember I still haven't learned the right way to abort.
Once sudo starts asking for a password it doesn't want to give up. You can't Ctrl+C it. If you give it the right password it will run the command that I've decided I want to abort. The only solution I have found is to give it wrong passwords until it gives up asking and falls back to an su prompt which actually listens to a Ctrl+C. This feels dirty to me. It's sad enough that I changed my mind about a command; not to be able to cancel it cleanly is just embarrassing.
What is the proper way to tell sudo to abort the attempt while at the password prompt?
Ctrl-cexits for me in bash and zsh...
sudoersthat would account for it.
Ctrl+Cand for many people it is, but in some situations it obviously isn't. I have not figured out the difference yet.