Tuesday, April 30, 2024
 Popular · Latest · Hot · Upcoming
4
rated 0 times [  4] [ 0]  / answers: 1 / hits: 3944  / 2 Years ago, sat, june 11, 2022, 3:32:19

This problem is in an up-to-date 12.04, and seems to have started recently.



I have my .bash_history file set to read only. Lately I've noticed that despite this the file is being modified !
Here's the scenario.
In a new terminal, here is the tail of the file:



$ tail -5 .bash_history 
mkdir -p ttt ; gs -dNOPAUSE -sDEVICE=png16m -r180 -sOutputFile=ttt/p%03d.png *.pdf
rsync -av /home/u1204 /media/SEAGATE/u1204
gnote.late.reminders|GREP_COLOR='1;32' egrep -i "is overdue"
pvr_iplayer -x -HD /home/u1204/Documents/pvr/tv-hd ; pvr_iplayer -x -STD /home/u1204/Documents/pvr/tv-std
exit


open a shell with raised privileges



 $ sudo bash [sudo] 
password for u1204:

# ls -l ~/.bash_history
-r-------- 1 u1204 u1204 1266 Feb 23 19:52 /home/u1204/.bash_history


so .bash_history is still definitely read-only.
Do something, then exit the escalated shell:



# echo "written to history file"
written to history file

# exit
exit


And Voilà, the history file has been modified !



$ ls -l ~/.bash_history
-r-------- 1 u1204 u1204 1324 Feb 23 20:10 /home/u1204/.bash_history


Open another terminal to confirm:



$ tail -5 .bash_history 
pvr_iplayer -x -HD /home/u1204/Documents/pvr/tv-hd ; pvr_iplayer -x -STD /home/u1204/Documents/pvr/tv-std
exit
ls -l ~/.bash_history
echo "written to history file"
exit


I'm pretty sure that it didn't used to do this (in 10.04 at least).



Anyway, this can't be correct behaviour, can it?


More From » 12.04

 Answers
4

Root has universal read/write to everything. Period.



Proponents of windows like to claim its authentication system is stronger because it doesn't have a "god" account and even local administrators can be explicitly denied.



You cannot deny root any access to any thing on the local system.



After some comments, it got me thinking you might be looking for a way to not write to bash history at all. You could do that like this: http://www.commandlinefu.com/commands/view/7041/dont-save-commands-in-bash-history-only-for-current-session



Putting unset HISTFILE in your bashrc for those that don't want to follow the link.


[#32519] Sunday, June 12, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
herfor

Total Points: 490
Total Questions: 101
Total Answers: 110

Location: Guadeloupe
Member since Mon, Jan 24, 2022
2 Years ago
;