LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   NOT escaping bash history (https://www.linuxquestions.org/questions/linux-general-1/not-escaping-bash-history-331213/)

ivanatora 06-07-2005 09:05 AM

NOT escaping bash history
 
When some user logouts, the history of his commands got written to $HOME/.bash_history
If for some reason the user unsets his enviroment variable $HISTFILE the history is lost and it cannot be viewed what he has done while he was logged in.
My question is, can I in some way prevent him for hiding his history? The shell is bash. Something like doesn't allowing him to unset enviroment variables or doesn't allowing him changing them. Normally he can hide this via
unset $HISTFILE
or
export $HISTFILE=/dev/null
Any ideas?

freakyg 06-07-2005 01:09 PM

heh, yes it's easy.....just move the users bash_history to a directory that only YOU know where and make a symlink back to the users ~/home.....that way the user has access and can write to it but, the user cannot delete it or erase it........LOL

oneandoneis2 06-07-2005 01:16 PM

Yeah, right up to the point he types in "echo $HISTFILE"

Even then, it doesn't stop the user from actually turning off bash's recording.

I don't believe it's possible. Even if you do manage to stop your user from turning off the history, he can always edit the history file with a text editor. Or switch to a different shell. Or use a USB key with its own version of Bash that completely bypasses your computer's protections. etc. etc.

LinuxSeeker 06-07-2005 01:17 PM

Quote:

heh, yes it's easy.....just move the users bash_history to a directory that only YOU know where and make a symlink back to the users ~/home.....that way the user has access and can write to it but, the user cannot delete it or erase it........LOL
What if the user types "history -o"? I think that this will erase the command history no matter what...


All times are GMT -5. The time now is 02:17 PM.