Artix Linux Forum

Artix Linux => System => Topic started by: mardiyah on 29 April 2023, 05:44:28

Title: Prevent any Linux package installer modifying by appending into ~/.bashrc
Post by: mardiyah on 29 April 2023, 05:44:28
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 ?
Title: Re: Prevent any Linux package installer modifying by appending into ~/.bashrc
Post by: Hitman on 29 April 2023, 16:22:53
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.
Title: Re: Prevent any Linux package installer modifying by appending into ~/.bashrc
Post by: gripped on 29 April 2023, 17:30:54
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.