nerdexam
CompTIA

XK0-005 · Question #802

An administrator needs to restrict a file's permission set in the following ways: - The file needs to be read and write, but it should not be executable to the file owner. - The file needs to be…

The correct answer is B. chmod 654 file.txt. To set specific permissions for the file owner, group owner, and others, the administrator should use the chmod command with an octal representation reflecting the desired read, write, and execute permissions.

Security

Question

An administrator needs to restrict a file's permission set in the following ways:

  • The file needs to be read and write, but it should not be executable

to the file owner.

  • The file needs to be read only and executable to the group owner.
  • The file needs to be read only to all other users.

Which of the following represents the next command the administrator should execute?

Options

  • Achmod 210 file.txt
  • Bchmod 654 file.txt
  • Cchmod 753 file.txt
  • Dchmod 777 file.txt

How the community answered

(66 responses)
  • A
    2% (1)
  • B
    83% (55)
  • C
    5% (3)
  • D
    11% (7)

Why each option

To set specific permissions for the file owner, group owner, and others, the administrator should use the `chmod` command with an octal representation reflecting the desired read, write, and execute permissions.

Achmod 210 file.txt

`chmod 210` would set permissions as: owner (write only), group (execute only), others (no permissions), which does not match the requirements.

Bchmod 654 file.txtCorrect

The `chmod` command with octal notation sets file permissions. The required permissions translate to: File owner: Read (4) + Write (2) = 6; Group owner: Read (4) + Execute (1) = 5; Others: Read (4) = 4. Combining these gives the octal permission 654.

Cchmod 753 file.txt

`chmod 753` would set permissions as: owner (read, write, execute), group (read, execute), others (write, execute), which does not match the requirements.

Dchmod 777 file.txt

`chmod 777` would grant read, write, and execute permissions to all users, group, and others, which is overly permissive and does not match the specific requirements.

Concept tested: Linux file permissions, chmod command, octal notation

Source: https://man7.org/linux/man-pages/man1/chmod.1.html

Topics

#File permissions#chmod command#Linux access control#Octal permissions

Community Discussion

No community discussion yet for this question.

Full XK0-005 Practice