exam questions

Exam XK0-005 All Questions

View all questions & answers for the XK0-005 exam

Exam XK0-005 topic 1 question 55 discussion

Actual exam question from CompTIA's XK0-005
Question #: 55
Topic #: 1
[All XK0-005 Questions]

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?

  • A. chattr +a /opt/app/logs
  • B. chattr +d /opt/app/logs
  • C. chattr +i /opt/app/logs
  • D. chattr +c /opt/app/logs
Show Suggested Answer Hide Answer
Suggested Answer: A 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
linux_admin
Highly Voted 8 months, 4 weeks ago
Selected Answer: A
The chattr +a command is used to set the "append only" attribute for a file or directory. This attribute ensures that once a file has been created, it cannot be deleted or modified. Any attempts to do so will result in a "permission denied" error. In this case, the command sets the "append only" attribute for the /opt/app/logs directory, which will prevent any changes to existing files or the deletion of files in that directory. New files can still be added to the directory, but their contents cannot be modified. This is useful in cases where the logs stored in the /opt/app/logs directory are critical for debugging or auditing purposes, and need to be kept for an extended period of time. The "append only" attribute helps to ensure the integrity of the logs, by preventing any accidental or malicious changes to the log files.
upvoted 7 times
...
Huckleberry
Most Recent 9 months ago
should be 'lsattr' not 'lsattz'
upvoted 3 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago