CompTIA Linux+ (XK0-004) — Question 264
An administrator wants to prevent the accidental deletion of a business-critical application log file without affecting the functionality of the application and its logging. Which of the following commands would BEST accomplish this goal?
Answer options
- A. setfacl -m u:application:w application.log
- B. chattr +a application.log
- C. chown nobody application.log
- D. chmod 400 application.log
Correct answer: B
Explanation
The command 'chattr +a application.log' allows the log file to be appended to but prevents it from being deleted, which is ideal for protecting critical logs. The other options either change permissions or ownership in ways that do not specifically prevent deletion, making them less suitable for this purpose.