Rewrite History!

“Oops, I just typed my password to the command-line!”
Yes. It happened to me. It was even the root-password. And since I feel unconfortable with that in a file on my disk, here is what I did to get rid of it:

Case 1: Not logged out, yet

In this case a simple “history -r” should do it, since it has not been written to disk, yet. I would log out & in after that and check in ”~/.bash_history” just to be sure.

Case 2: Logged out, history has been saved

  1. edit ”~/.bash_history”: Delete all lines containg the password
  2. remove the editor's backup (“rm ~/.bash_history~” for emacs)
  3. re-read the modified history using “history -r”
  4. log out & in after that and check in ”~/.bash_history” just to be sure.
/home/www/LinuxBasics.org/data/pages/tutorials/advanced/realworld/sensitive_data_in_history.txt · Last modified: 2008/07/20 21:08 (external edit)
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0