prevent users from editing or deleting .bash_history

PlatinumServerM

Well-Known Member
PartnerNOC
Jul 10, 2005
400
3
168
New Jersey, USA
cPanel Access Level
Root Administrator

mahinder

Well-Known Member
Jun 12, 2003
69
0
156
matrix
Do you want the .bash_history to be disabled so it won't record? or you just don't want them to be able to manually edit/remove it?
i don't want them to be able to manually edit/remove it. I have one suspecious user who ssh on server but his .bash_history is always empty. it appears he is doing something suspicious on server but is .bash_history is always empty hence its obvious that he is removing commands from history file. I want to prevent this.

can any one help? nick!
 

txmom

Member
Apr 29, 2009
5
0
51
If they can't clear their history, they'll know something's up.

Can you run a CRON job to periodically copy the file to your location?

I must say that we want to be careful to preserve their right to privacy.
 

teh

Member
Jul 13, 2008
5
0
51
You know, there are ext2/3 file system attributes. There's the append-only flag. Read the manual pages for lsattr and chattr.