Linux Shell Scripting Cookbook(Third Edition)
上QQ阅读APP看书,第一时间看更新

How to do it...

To make the files immutable, follow these steps:

  1. Use chattr to make a file immutable:
        # chattr +i file
  1. The file is now immutable. Try the following command:
        rm file
        rm: cannot remove `file': Operation not permitted
  1. In order to make it writable, remove the immutable attribute, as follows:
        chattr -i file