ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 4 - XK0-005 discussion

Report
Export

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
Answers
A.
chattr +a /opt/app/logs
B.
chattr +d /opt/app/logs
Answers
B.
chattr +d /opt/app/logs
C.
chattr +i /opt/app/logs
Answers
C.
chattr +i /opt/app/logs
D.
chattr +c /opt/app/logs
Answers
D.
chattr +c /opt/app/logs
Suggested answer: A

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 renamed. This is the best command to use to accomplish the task. The other options are incorrect because they either set the wrong attributes (+d, +i, or +c) or do not affect the file at all (-a). Reference: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 11: Managing Files and Directories, page 357.

asked 02/10/2024
Laurence Peterson
34 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first