Linux – Removing Previously Typed Commands on Remote Server

linuxpassword-managementpasswordsSecurityUbuntu

I am ssh'ing into a remote server and then su'ing to root.

The problem is that sometimes, I have not paid enough attention to the console message, and I have accidentally typed in the root password at the command prompt (when for example, I had failed to provide the root password correctly the first time – so su prompt went away).

I remember reading somewhere that a history of commands typed at the console is kept somewhere.

I have 3 sub questions

  1. Where (which folder) is the file stored?
  2. Can I edit that file and remove the root password from it?
  3. Being the paranoid person that I am, I wonder if there is a more secure way of logging into my server – other than ssh (or am I being TOO paranoid?)

My server is running a headless Ubuntu 10.0.4

Best Answer

If you are using bash, the history is in ~/.bash_history, yes, you can edit it.

But there's nothing that will prevent you from entering your password in the wrong place, short of paying attention.