- In this video you'll learn about filesystem attributes.
So the POSIX standard defines a number of attributes
that can be used to add security to files.
You can use chattr to set them,
and lsattr to get an overview
of currently applied attributes.
There is a couple of attributes that is defined,
but the immutable attribute is most common.
Let me show you.
So I'm creating a file with the name removeme.txt,
and then chattr +i on removeme.txt.
Now what is going to happen
if they use rm -f on removeme.txt?
I'm getting an operation not permitted.
But I am root, yes that is right,
but lsattr on removeme
is showing that the immutable attribute is set,
and if an attribute is set, even if you are root,
you can't remove it without first removing the attribute.
And that's what I'm doing next,
chattr -i on removeme.txt, and now it's gone,
and now I should be able to remove the file.
There we go, and now it's gone.
That is how you can use attributes.
This is pretty convenient
if you want to add some protection to files,
and you wanna make sure nobody by accident is removing them.
Now if you have a look at the man page, man chattr,
then you can see all the letters that can be used
for the attributes right here.
But as I was telling you,
many of these attributes are not really very well supported.