A system administrator needs to secure a critical application log file, /var/log/audit/app_security.log, on a Linux server. The requirements are to prevent anyone, including the root user, from deleting or modifying the existing contents of the file, but still allow the application to add new log entries. Which command will accomplish this?
The correct command is chattr +a /var/log/audit/app_security.log. The chattr command is used to change file attributes on a Linux file system. The +a option sets the 'append-only' attribute. A file with this attribute can only be opened in append mode for writing, meaning data can be added to the end of the file, but existing data cannot be modified or deleted. This restriction applies even to the root user.
chattr +i /var/log/audit/app_security.log is incorrect because the +i option sets the 'immutable' attribute. An immutable file cannot be modified in any way; it cannot be deleted, renamed, and no data can be written to it, including appending.
chmod 640 /var/log/audit/app_security.log is incorrect. The chmod command changes the standard read, write, and execute permissions. While this command restricts write access to the file's owner, it does not prevent the owner or the root user from overwriting or deleting the file. It does not enforce an 'append-only' behavior.
chown audit:root /var/log/audit/app_security.log is incorrect. The chown command changes the user and/or group ownership of a file. While this is an important security practice, it does not, by itself, prevent the file from being modified or deleted by its new owner or the root user.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What does the 'chattr' command do in Linux?
Open an interactive chat with Bash
How does the '+a' attribute differ from the '+i' attribute in 'chattr'?
Open an interactive chat with Bash
Why doesn't 'chmod 640' provide the same protection as 'chattr +a'?
Open an interactive chat with Bash
CompTIA Linux+ XK0-006 (V8)
Security
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
Pass with Confidence.
IT & Cybersecurity Package
You have hit the limits of our free tier, become a Premium Member today for unlimited access.
Military, Healthcare worker, Gov. employee or Teacher? See if you qualify for a Community Discount.
Monthly
$19.99
$19.99/mo
Billed monthly, Cancel any time.
3 Month Pass
$44.99
$14.99/mo
One time purchase of $44.99, Does not auto-renew.
MOST POPULAR
Annual Pass
$119.99
$9.99/mo
One time purchase of $119.99, Does not auto-renew.
BEST DEAL
Lifetime Pass
$189.99
One time purchase, Good for life.
What You Get
All IT & Cybersecurity Package plans include the following perks and exams .