Results 1 to 4 of 4

Thread: bash: is it possible to disable logging to .bash_history?

  1. #1
    Junior Member
    Join Date
    Jul 2002
    Posts
    54

    bash: is it possible to disable logging to .bash_history?

    ... either for one command or for a whole session? I dont want any "sensitive" commands to end up in my history in case someone else sees it. This is for a system in which I only have access to a 'guest' account.

  2. #2
    Moderator
    Advisor
    redhead's Avatar
    Join Date
    Jun 2001
    Location
    Copenhagen, Denmark
    Posts
    811

    Re:bash: is it possible to disable logging to .bash_history?

    # mv .bash_history .bash_history_old
    # ln -sf /dev/null .bash_history
    <do what ever stuff needs to be hidden, and logout>
    <login again and>
    # rm .bash_history
    # mv .bash_history_old .bash_history

  3. #3
    Moderator
    Advisor
    redhead's Avatar
    Join Date
    Jun 2001
    Location
    Copenhagen, Denmark
    Posts
    811

    Re:bash: is it possible to disable logging to .bash_history?

    Just found this in man bash:
    HISTCONTROL
    If set to a value of ignorespace, lines which begin
    with a space character are not entered on the his*
    tory list. If set to a value of ignoredups, lines
    matching the last history line are not entered. A
    value of ignoreboth combines the two options. If
    unset, or if set to any other value than those
    above, all lines read by the parser are saved on
    the history list, subject to the value of HISTIG*
    NORE. This variable's function is superseded by
    HISTIGNORE. The second and subsequent lines of a
    multi-line compound command are not tested, and are
    added to the history regardless of the value of
    HISTCONTROL.
    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.
    HISTFILESIZE
    The maximum number of lines contained in the his*
    tory file. When this variable is assigned a value,
    the history file is truncated, if necessary, to
    contain no more than that number of lines. The
    default value is 500. The history file is also
    truncated to this size after writing it when an
    interactive shell exits.
    HISTIGNORE
    A colon-separated list of patterns used to decide
    which command lines should be saved on the history
    list. Each pattern is anchored at the beginning of
    the line and must match the complete line (no
    implicit `*' is appended). Each pattern is tested
    against the line after the checks specified by
    HISTCONTROL are applied. In addition to the normal
    shell pattern matching characters, `&' matches the
    previous history line. `&' may be escaped using a
    backslash; the backslash is removed before attempt*
    ing a match. The second and subsequent lines of a
    multi-line compound command are not tested, and are
    added to the history regardless of the value of
    HISTIGNORE.
    HISTSIZE
    The number of commands to remember in the command
    history (see HISTORY below). The default value is
    500.
    Any of those should be something that would help your situation.

    Taking this into considderation, making a:
    # export HISTFILE="/dev/null"
    befor all the bad stuff, might be the way to go..

  4. #4
    Junior Member
    Join Date
    Jul 2002
    Posts
    54

    Re:bash: is it possible to disable logging to .bash_history?

    Thanks, guess I should have read the man

Similar Threads

  1. Postfix Disable Outbound Mail
    By countach44 in forum Linux - Software, Applications & Programming
    Replies: 0
    Last Post: 09-22-2009, 05:36 AM
  2. how to disable error reporting in win 2k
    By Harishs in forum Windows - General Topics
    Replies: 3
    Last Post: 07-21-2005, 11:59 AM
  3. how to disable remove from startup
    By Harishs in forum Windows - General Topics
    Replies: 1
    Last Post: 07-15-2005, 07:21 PM
  4. disable finger
    By Black666 in forum Linux - Software, Applications & Programming
    Replies: 4
    Last Post: 07-16-2002, 04:54 AM
  5. Disable automatic disconnect
    By Black666 in forum Linux - Hardware, Networking & Security
    Replies: 2
    Last Post: 05-25-2002, 06:26 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •