Several users can write to /srv/dropbox.
Prevent users from freely deleting files owned by other users while preserving ordinary permissions.
Which command is appropriate?
A directory sticky bit restricts deletion and renaming in a shared writable directory to the file owner, directory owner, or a privileged process.
Detailed explanation
chmod +t /srv/dropboxCorrect. chmod +t /srv/dropbox sets the directory sticky bit.
Correct. chmod +t /srv/dropbox sets the directory sticky bit.
chmod u+s /srv/dropboxIncorrect. u+s sets setuid.
Incorrect. u+s sets setuid.
chmod g+s /srv/dropboxIncorrect. g+s sets setgid.
Incorrect. g+s sets setgid.
chmod a-x /srv/dropboxIncorrect. Removing execute permission would affect traversal rather than enforce restricted deletion.
Incorrect. Removing execute permission would affect traversal rather than enforce restricted deletion.
Try it yourself
An example you can run in a temporary verification environment.
stat --format=%A /tmpExpected result
一般的なLinuxでは末尾tを含むdrwxrwxrwtKey points
- +t sets sticky bit
- Restricted deletion
- Shared writable directories
Notes
- Environment: GNU coreutils 9.x/Linux
- 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.