LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 06-07-2005, 09:05 AM   #1
ivanatora
Member
 
Registered: Sep 2003
Location: Bulgaria
Distribution: Ubuntu 9.10, FreeBSD 7.2
Posts: 459

Rep: Reputation: 32
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?
 
Old 06-07-2005, 01:09 PM   #2
freakyg
Member
 
Registered: Apr 2005
Distribution: LFS 5.0 and 6.1
Posts: 705

Rep: Reputation: 30
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
 
Old 06-07-2005, 01:16 PM   #3
oneandoneis2
Senior Member
 
Registered: Nov 2003
Location: London, England
Distribution: Ubuntu
Posts: 1,460

Rep: Reputation: 48
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.
 
Old 06-07-2005, 01:17 PM   #4
LinuxSeeker
Member
 
Registered: Feb 2004
Location: Linuxland
Distribution: Ubuntu 5.10, KUbuntu 5.10, Mandrake 10.1 - Ubuntu 5.04 (Hoary)
Posts: 346

Rep: Reputation: 30
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...
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Automatic special character escaping in Bash scripts? wipe Linux - Software 1 06-05-2009 06:41 PM
Bash history file jinksys Linux - Software 2 07-30-2005 03:58 PM
history not working in bash subu_s AIX 2 12-29-2004 12:49 PM
bash history slowly Linux - General 2 11-12-2004 11:35 AM
Bash History ukndoit Linux - Security 2 10-16-2003 09:02 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 09:54 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration