Software >> OS >> Unix >> Linux >> How to set files to be immutable using chattr command

use chattr command

Usage: chattr [-RVf] [-+=AacDdeijsSu] [-v version] files...

check current setting with lsattr command

Usage: lsattr [-RVadlv] [files...]

 

Set immutable flag

# chattr +i important_file.conf

 

Unset immutable flag

# chattr -i important_file.conf

Set append only flag

# chattr +a example.txt

Unset append only flag
# chattr -a example.txt

Set recursively

# chattr -R +i myfolder

Unset recursively

# chattr -R -i myfolder



 

References

[1] http://www.tecmint.com/chattr-command-examples/