Another way to apply security to files is by using file system attributes.
That's a POSIX definition, and POSIX goes back to the UNIX standard that has been defined
a long time ago to guarantee standard solutions between different UNIX distributions.
So POSIX defines a number of attributes that can be used to add security to files.
And you can use chatter for change attribute to set them, and ls for list attribute to
get an overview of currently applied attributes.
And of all the attributes, the immutable attribute is common.
You'll also find the a attribute, which allows you to append to a file, but nothing else.
Now the nice thing about the attribute is that these attributes are irrespective of
the user that is going to hit the file that has an attribute.
Let's check it out.
So I can do this as the root user in my own home directory, because as I told you, attributes
don't really relate to the user.
I'm going to create, touch my file, and ls-l is showing the property of my file.
It's an empty file with read, write, read, and read permissions.
And we also see this dot.
Now the dot is interesting, because that is the indicator that some attributes apply.
If I'm using ls-attr on my file, then we can see the list of all the attributes.
Aha, no attributes apply.
We just have an area in the metadata of the file to store attributes.
Well, that's good.
Let's use ch-attr plus a on my file to add this append attribute in ls-attr my file.
And there you can see that it works.
And echo hello greater than greater than to my file.
Is that allowed?
Yeah, that is allowed.
And rm on my file, and that is asking if you want to remove it.
And there we can see the attribute in action.
Operation not permitted, not even for user root.
So if ever a user root, you encounter a situation where you think, what is going on?
I would advise you check if any attributes apply.