unset HISTFILE kann die .bash_history von root nicht deaktivieren

601
Huy.PhamNhu

Um das Verhalten System breit zu machen, habe ich unset HISTFILEin /etc/profile. Normale Benutzer haben dies nicht mehr .bash_history, root jedoch noch. Kann mir jeder sagen, was ich hier falsch mache? Oder was ist ein anderer richtiger Platz, den ich anstelle von verwenden sollte /etc/profile? Es gibt /root/.bashrcwelche, die wahrscheinlich den Trick für root machen, aber ich möchte diese Einstellung nur an einem globalen Ort, damit ich sie leicht umschalten kann, Pogo?

0

1 Antwort auf die Frage

2
Jaroslav Kucera

You must take in count the order, how these files apply when user/root logs in. The profile is read first, the ~/.bashrc the last so if you set/unset some variable in the profile, it can be overwritten in the ~/.bashrc of each user. So what you made is like template of the environment, which can be overwritten.

And there are more files you'd better have a look at:

  • content of /etc/profile.d
  • /etc/bash.bashrc

It's better described in this post:

https://serverfault.com/questions/261802/what-are-the-functional-differences-between-profile-bash-profile-and-bashrc