ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 186 - XK0-005 discussion

Report
Export

The development team wants to prevent a file from being modified by all users in a Linux system, including the root account. Which of the following commands can be used to accomplish this objective?

A.
chmod / app/conf/file
Answers
A.
chmod / app/conf/file
B.
setenforce / app/ conf/ file
Answers
B.
setenforce / app/ conf/ file
C.
chattr +i /app/conf/file
Answers
C.
chattr +i /app/conf/file
D.
chmod 0000 /app/conf/file
Answers
D.
chmod 0000 /app/conf/file
Suggested answer: C

Explanation:

Thechattrcommand is used to change file attributes on Linux systems that support extended attributes, such as ext2, ext3, ext4, btrfs, xfs, and others. File attributes are flags that modify the behavior of files and directories.

To prevent a file from being modified by all users in a Linux system, including the root account, the development team can use thechattr +i /app/conf/filecommand. This command will set the immutable attribute (+i) on the file/app/conf/file, which means that the file cannot be deleted, renamed, linked, appended, or written to by any user or process. To remove the immutable attribute, the development team can use thechattr -i /app/conf/filecommand. The statement C is correct.

The statements A, B, and D are incorrect because they do not prevent the file from being modified by all users. Thechmod /app/conf/filecommand does not work because it requires an argument to specify the permissions to change. Thesetenforce /app/conf/filecommand does not work because it is used to change the SELinux mode, not file attributes. Thechmod 0000 /app/conf/filecommand will remove all permissions from the file, but it can still be modified by the root account.Reference: [How to Use chattr Command in Linux]

asked 02/10/2024
Unai M
39 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first