nerdexam
CompTIA

XK0-005 · Question #1209

A Linux user wants to give read-only permissions to a directory and its contents. Which of the following commands will allow the user to accomplish this task?

The correct answer is A. chmod -R 400 /new_directory/. Option A, 'chmod -R 400 /new_directory/', uses two key components: the -R (recursive) flag to apply the permission change to the directory and all files/subdirectories within it, and the octal mode 400 (r--------) which grants read-only permission to the owner with no write or…

System Management

Question

A Linux user wants to give read-only permissions to a directory and its contents. Which of the following commands will allow the user to accomplish this task?

Options

  • Achmod -R 400 /new_directory/
  • Bchmod -R 600 /new_directory/
  • Cchmod 400 /new_directory/
  • Dchmod 600 /new_directory/

How the community answered

(53 responses)
  • A
    72% (38)
  • B
    8% (4)
  • C
    4% (2)
  • D
    17% (9)

Explanation

Option A, 'chmod -R 400 /new_directory/', uses two key components: the -R (recursive) flag to apply the permission change to the directory and all files/subdirectories within it, and the octal mode 400 (r--------) which grants read-only permission to the owner with no write or execute bits set. Option B uses 600 (rw-------), which includes write permission - not read-only. Options C and D omit the -R flag, so they only change the top-level directory's permissions and do not affect the contents inside it.

Topics

#File Permissions#chmod command#Octal Permissions#Recursive Operations

Community Discussion

No community discussion yet for this question.

Full XK0-005 Practice