February 2020
Intermediate to advanced
666 pages
15h 45m
English
Now, I'll set the a attribute:
[donnie@localhost ~]$ sudo chattr +a perm_demo.txt[sudo] password for donnie:[donnie@localhost ~]$
You use + to add an attribute and - to delete it. Also, it doesn't matter that the file belongs to me and is in my own home directory. I still need sudo privileges to add or delete this attribute.
Now, let's see what happens when I try to overwrite this file:
[donnie@localhost ~]$ echo "I want to overwrite this file." > perm_demo.txt-bash: perm_demo.txt: Operation not permitted[donnie@localhost ~]$ sudo echo "I want to overwrite this file." > perm_demo.txt-bash: perm_demo.txt: Operation not permitted[donnie@localhost ~]$
With or without sudo privileges, I can't overwrite it. So, how about ...