Skip to Content
Mastering Linux Security and Hardening - Second Edition
book

Mastering Linux Security and Hardening - Second Edition

by Donald A. Tevault
February 2020
Intermediate to advanced
666 pages
15h 45m
English
Packt Publishing
Content preview from Mastering Linux Security and Hardening - Second Edition

Setting the a attribute

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 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering Linux Security and Hardening - Third Edition

Mastering Linux Security and Hardening - Third Edition

Donald A. Tevault
UNIX and Linux System Administration Handbook, 5th Edition

UNIX and Linux System Administration Handbook, 5th Edition

Trent R. Hein, Evi Nemeth, Garth Snyder, Ben Whaley, Dan Mackin

Publisher Resources

ISBN: 9781838981778Supplemental Content