cancel
Showing results for 
Search instead for 
Did you mean: 

how to hide history

SOLVED
Go to solution
avizen9
Esteemed Contributor

how to hide history

HI,
when we login with root and apply any command default its store in history and later we can check it through history command, i would like to hide it, i know we can use history -c but i want to keep all history only for me and no one else can see it, how i can do this for same root user, any idea to anyone, thanks,
3 REPLIES
Patrice Le Guyader
Respected Contributor
Solution

Re: how to hide history

hello,

What you can do is to have one history file for each user connected with root. Try to connect in two terminal and have a look to your tty.

Here is what I use to do to separate the history file for each root connection.

In your .profile put this :

HISTFILE=/root/.sh_history/.sh_history.`tty|sed 's/\///g'|cut -c4-`
PS1="$(hostname):\$PWD\#"
export HISTFILE PS1

You'll probably have to tune it according to the shell you're using.

Hope this help
Kenavo
Pat


Good judgement comes with experience. Unfortunately, the experience usually comes from bad judgement.
Steven E. Protter
Exalted Contributor

Re: how to hide history

Shalom,

Write a cron job to copy it off to a location only root can access.

You can not hide a file from the user that creates it without denying that user access and ending the logging process.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
dirk dierickx
Honored Contributor

Re: how to hide history

you should not login as root, use sudo. that will allow you to run root commands and your history will be yours only.

why are you using root? did you admin windows machines previously? unix/linux is an whole other world with other rules.