Chattr: Operation not permitted while setting flags on hosts

I do not understand what is going on ?

I want my hosts to be much harder to edit.

I could not find any answers here.

andy@7:/etc$ chattr +i hosts
chattr: Operation not permitted while setting flags on hosts
andy@7:/etc$

You are dealing with a file in protected "/etc".

ROOT privilege required for that action.

Also, you want to "add" the "immutable" property. So ...

sudo    chattr  +i  /etc/hosts
3 Likes

It worked great. :slight_smile:

My hosts still works at blocking sites after adding the immutable attribute.