Category Archives: Shell

Remember to Delete the Root Password from Your History File

Ok, so you accidentally type in the root password before using su -.

$ ThisIsMyRootPassword

Now you have to remember to delete it from your history file. This is somewhat non-obvious, because the history file is typically saved on successful exit.

So if you immediately do something like this.

$ tail -2 ~/.bash_history
ssh somehost
su -

There’s nothing suspicious in the history file.

So, log out, then log back in. Typically that means closing your ssh session, or terminal tab, and open a new session.

Now you see the password in the history file.

$ tail -2 ~/.bash_history
su -
ThisIsMyRootPassword

So fire up an editor and delete the line.