Security

An administrator must ensure that /var/log/audit-custom.log can only have new lines added by processes and cannot be truncated, edited in place, or deleted, while logging continues to work. Which command should be used?

Show the answer

Correct answerA. chattr +a /var/log/audit-custom.log

The append-only attribute (+a) lets a file be opened only in append mode, so logging continues while truncation, overwriting and deletion are prevented. The immutable attribute (+i) is tempting but would block all writes, which would stop the logging.