Bad History when SuperUser.
C. Linus Hicks
lhicks at nc.rr.com
Mon Oct 11 07:20:43 UTC 2004
On Mon, 2004-10-11 at 02:52, Reg Clemens wrote:
> OK, this error has been in the shells for a long time.
>
> If you bring up a new window, or just a shell as a regular user,
> and then type 'history' you see what you should expect, one line
> with the history command.
>
> If you now do a su, and become root, and then do the same 'history'
> command you will see several hundred lines of history from who knows
> how many previous sessions as root.
>
> If you bring up a second window, and become root there too, doing the
> 'history' command will show the same -history- as the first (sigh)
>
> Shouldn't these things be truncated when the root shell closes down?
>From 'man bash' that is your choice. In the section on 'Shell Variables'
you can see this:
HISTFILE
The name of the file in which command history is
saved (see HISTORY below). The default value is
~/.bash_history. If unset, the command history is
not saved when an interactive shell exits.
So, if you want an empty history on startup, make sure HISTFILE is
unset.
--
C. Linus Hicks <lhicks at nc.rr.com>
More information about the users
mailing list