CompTIA

XK0-006 practice question 11

CompTIA Linux+ · free question 11 of 20

Question

A systems administrator wants to prevent the current contents of a file from being overwritten and wants to allow new additions at the end of the file. Which of the following commands should the administrator use?
  • A. setenforce file
  • B. setfacl -m m::t file
  • C. chattr +a file Correct
  • D. chmod +t file

Explanation

chattr +a sets the append-only attribute, so the file can be opened for writing only in append mode: existing data cannot be overwritten or truncated, but new data can be added at the end. setenforce switches the SELinux mode and does not act on a file. chmod +t sets the sticky bit, which controls deletion in directories, and setfacl changes ACL entries, not append behaviour.

Practice the whole free set

Answer all 20 free XK0-006 questions with instant feedback, or unlock all 154 questions with Learn and Exam modes.