nerdexam
CompTIA

XK0-005 · Question #1536

A Linux engineer has been notified about the possible deletion of logs from the file /opt/app/logs. The engineer needs to ensure the log file can only be written into without removing previous…

The correct answer is A. chattr +a /opt/app/logs. The command chattr +a /opt/app/logs will ensure the log file can only be written into without removing previous entries. The chattr command is a tool for changing file attributes on Linux file systems. The +a option sets the append-only attribute, which means that the file can…

System Management

Question

A Linux engineer has been notified about the possible deletion of logs from the file /opt/app/logs. The engineer needs to ensure the log file can only be written into without removing previous entries. Which of the following commands would be BEST to use to accomplish this task?

Options

  • Achattr +a /opt/app/logs
  • Bchattr +d /opt/app/logs
  • Cchattr +i /opt/app/logs
  • Dchattr +c /opt/app/logs

How the community answered

(39 responses)
  • A
    92% (36)
  • C
    5% (2)
  • D
    3% (1)

Explanation

The command chattr +a /opt/app/logs will ensure the log file can only be written into without removing previous entries. The chattr command is a tool for changing file attributes on Linux file systems. The +a option sets the append-only attribute, which means that the file can only be opened in append mode for writing. This prevents the file from being modified, deleted, or

Topics

#chattr command#File attributes#Log file protection#Linux security

Community Discussion

No community discussion yet for this question.

Full XK0-005 Practice