Skip to main content
Topic: Prevent any Linux package installer modifying by appending into ~/.bashrc (Read 326 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Prevent any Linux package installer modifying by appending into ~/.bashrc

How to prevent any Linux package installer and its sub processes to modify, append the ~/.bashrc, or any certain file else, which must remain normally able to be used, edited etc freely by the login user ?

Re: Prevent any Linux package installer modifying by appending into ~/.bashrc

Reply #1
Try to set immutable attribute (chattr +i), and see if the shell complains at next login.
To edit it later you will have to unset that attribute with -i
AFAIK there is no other easy way apart maybe from complex apparmor/selinux/maybe polkit rules which few use so it's little documented.

Re: Prevent any Linux package installer modifying by appending into ~/.bashrc

Reply #2
Or copy ~/.bashrc to ~/.mybashrc (or similar)

edit ~/bash_profile to point at the copy
Code: [Select]
[[ -f ~/.mybashrc ]] && . ~/.mybashrc

Then if you have issues in the future where things don't work you can refer to ~/.bashrc to see what a package is expecting in the PATH or environment variables etc.