A system administrator needs to protect a critical configuration file, /etc/important.conf, from any accidental modification or deletion. The file must be unchangeable by any user, including root, but it still needs to be readable by the system. Which of the following commands will BEST accomplish this task?
The correct command is sudo chattr +i /etc/important.conf. The chattr command is used to change file attributes on a Linux filesystem. The +i flag sets the immutable attribute on a file. An immutable file cannot be modified, deleted, or renamed, and no links can be made to it, not even by the root user. To remove the attribute, one would need to use chattr -i.
The command sudo chattr +a /etc/important.conf is incorrect because the +a flag sets the append-only attribute. This would prevent overwriting but would still allow data to be added to the end of the file, which is not the requirement for a static configuration file.
The command sudo chmod 444 /etc/important.conf is incorrect because it only sets read-only permissions for the owner, group, and others. The root user can easily bypass these permissions to modify or delete the file.
The command sudo chown root:root /etc/important.conf is incorrect as it only changes the user and group ownership of the file to root. It does not prevent the root user, or other users with sufficient permissions, from modifying or deleting the file.
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
Why is the `+i` attribute more secure than `chmod 444`?
Open an interactive chat with Bash
How can you remove the immutable attribute from a file?
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...
IT & Cybersecurity Package Join Premium for Full Access