Do not change the owner permissions on secret.txt.
Remove read, write, and execute permissions from group and other users.
Which command is appropriate?
The symbolic classes go select group and others together, and -rwx removes all three ordinary permissions from those classes.
Detailed explanation
chmod u-rwx secret.txtIncorrect. u selects the owner, which must remain unchanged.
Incorrect. u selects the owner, which must remain unchanged.
chmod a-rwx secret.txtIncorrect. a also removes the owner's permissions.
Incorrect. a also removes the owner's permissions.
chmod go-rwx secret.txtCorrect. chmod go-rwx secret.txt changes only group and other permissions.
Correct. chmod go-rwx secret.txt changes only group and other permissions.
chmod go+rwx secret.txtIncorrect. + adds permissions rather than removing them.
Incorrect. + adds permissions rather than removing them.
Try it yourself
An example you can run in a temporary verification environment.
chmod --helpExpected result
MODEは対象、演算子、権限の記号で指定できるKey points
- g is group
- o is other
- - removes permissions
Notes
- Environment: GNU coreutils 9.x
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Read the scope first
Check whether the command acts on the current shell, a new process, an existing process, or a file.
Verify the observable result
Use the supplied command and compare the output with the expected result.