Related Question, less specific: Automatic cleanup of Bash history
This question focuses on a single problem.
Over time, a user will eventually enter a password on the command line by accident, and may even press enter, which will place the password in history. The user probably was expecting a password prompt, but something was typed wrong, causing that prompt to not show.
This user may not know how to clean up the history with
history -d, or may be too busy to think about it.
I suggest removing all history items that are not found in
which, or other white-list. An added benefit is you will not make the same mistake twice on a mis-typed command, not found in
Do you know of
- a way to tell
bashto run my cleanup script before, or right after writing history,
- an option that includes this particular
whichbased cleanup already, or
- an alternative way to prevent passwords from being stored in