I do log everything you type into the form. Privacy note: This form will forward your IP address, user agent and referrer to the Akismet, StopForumSpam and Botscout spam filtering services. Obviously, you will need to put the appropriate content into the file before setting the immutable bit. You can add class="your language" to code blocks to help highlight.js highlight them correctly. rm -f /etc/nf editor /etc/nf chattr +i /etc/nf.You can use Markdown syntax to format your comments.You may want to read the comment guidelines before posting. There are a bunch more attributes listed in the chattr man page though this is the only one I ever seem to find myself using. You can unset the immutable attribute using -i chattr -i nf Rm: cannot remove ‘/etc/nf’: Operation not permitted chattr +i /etc/nf should stop any changes to it - cron / bootscript seems more complicated than it needs be. Now you cannot change the file at all! $ sudo rm /etc/nf So that now lsattr shows $ lsattr /etc/nf
You might need root, deending on the file. Which can be prevented if the file system allows it with: Code: chattr -V +i /etc/resolv. You use the chattr command to set the attribute. This way, the file wont get updated from resolvconf ever. You can view the current attributes of a file any time using lsattr lsattr nf The immutable attribute means that no user, not even root, can modify the file without also unsetting the attribute. I set the immutable attribute on the file. I turned to a trick that I very rarely use, but which is useful from time to time.
It kept overwriting my /etc/nf - the file where you configure what nameservers your system will use.Įven after I uninstalled Network Manger, on rebooot I would find my nf saying it had been generated by Network Manager. I wonder if some process in Ubuntu has made it immutable (to stop YOU from editing/changing it).The other day, I was having some problems with Network Manager (I only ever have problems with it to be honest). Making it immutable stops them from doing so. These background processes all run as root, of course, and assume they are free to mung the nf file at will. There are lots of background processes and stuff that can and do make changes to that file - and, in this situation as described, you don't want them to do so. This is because sometimes you really, really want to set it up a certain way and have it stay that way. I mention all this because it has been discussed here and I have sometimes gone down the road of making /etc/nf immutable. You should read "man chattr" and "man lsattr". There is a program called "chattr" that allows to, among other things, make a file "immutable" so that even root can't change it (unless/until, root clears the immutable bit). Well, the obvious question is: How did it let you edit (and save) the file before (when you deleted the line), but now it doesn't? What has changed between then and now?Īnyway, one possibility is that the file has become "immutable".