Protecting a file using chattr command

Standard

Write protecting a file using chattr command

Let say you want to write protect the file called data.txt so that no other users can change it including root user, enter (you must login as the root user to use chattr command):

# chattr +i data.txt

To remove i attribute, enter:

# chattr -i data.txt