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

Hands-on lab – setting security-related extended file attributes

For this lab, you'll need to create a perm_demo.txt file with some text of your choice. You'll set the i and a attributes and view the results. Let's get started:

  1. Using your preferred text editor, create the perm_demo.txt file with a line of text.
  2. View the extended attributes of the file:
lsattr perm_demo.txt
  1. Add the a attribute:
sudo chattr +a perm_demo.txtlsattr perm_demo.txt
  1. Try to overwrite and delete the file:
echo "I want to overwrite this file." > perm_demo.txtsudo echo "I want to overwrite this file." > perm_demo.txtrm perm_demo.txtsudo rm perm_demo.txt
  1. Now, append something to the file:
echo "I want to append this line to the end of the file." >> perm_demo.txt ...
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