Link to home
Start Free TrialLog in
Avatar of gordonmann
gordonmannFlag for United States of America

asked on

How to remove the entries in the "history" file from the command line

Ou company allows several users access to the root user on our systems.  The problem I am havong is they are "experimenting" with commands that I have had to use to correct errors.  How can I either 1) prevent logging from specific users or 2) erase the history log.  I prefer option 1.
Avatar of Tintin
Tintin

Do the users login directly as root or do su -

To remove the bash history, just do

rm -f ~/.bash_history

You can have separate history files based on whatever criteria you come up with (eg: login name, terminal name, IP address etc).

For example, to have a separate history file based on the tty name, put the following in ~/.bash_profile

export HISTFILE=$HOME/.bash_history-$(tty|sed #/#-#g)
Avatar of gordonmann

ASKER

Everyone su to root

What if I just want a separate history file for myself BUT still want the ability to view what other users have done while logged in as root.
ASKER CERTIFIED SOLUTION
Avatar of Tintin
Tintin

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Great help!!!