Which of the following commands set the sticky bit for the directory /tmp? (Choose TWO correct answers.)
Which of the following commands set the sticky bit for the directory /tmp? (Choose TWO correct answers.)
To set the sticky bit for the directory /tmp, you can use either 'chmod +t /tmp' or 'chmod 1775 /tmp'. The sticky bit is a special permission that allows only the file's owner, the directory's owner, or the superuser to delete or rename the files within that directory. Using 'chmod +t' adds the sticky bit symbolically, while using 'chmod 1775' sets the sticky bit along with the directory's permissions in octal notation.
The correct commands to set the sticky bit for the directory /tmp are: C. chmod 1775 /tmp E. chmod 2775 /tmp Both of these commands set the sticky bit on the /tmp directory. The sticky bit is represented by the number 1 in the first digit of the permission mode (i.e., as the most significant bit in the digit). Option A (chmod +s /tmp) sets the setuid (SUID) bit, not the sticky bit. Option B (chmod +t /tmp) is not a valid way to set the sticky bit. Option D (chmod 4775 /tmp) sets the SUID bit and the group-execute permission, but it doesn't set the sticky bit. So, options C and E are the correct ones for setting the sticky bit on the /tmp directory.
chmod 1777 dir chmod +t dir
B. chmod +t /tmp C. chmod 1775 /tmp The sticky bit is a permission bit that makes a directory such that only the owner of the file within those directories can delete or rename the files. The symbolic method to set the sticky bit is with +t and the octal method is with a leading 1 in the four-digit octal representation.
The correct answers are: B. chmod +t /tmp D. chmod 4775 /tmp Explanation: The sticky bit is a special permission flag that can be set on directories. When applied to a directory, it modifies the behavior of file deletion within that directory. Specifically, it restricts the deletion of files within the directory to: The owner of the file The owner of the directory The superuser (root) The correct commands: chmod +t /tmp: This uses the symbolic mode to add (+t) the sticky bit to the /tmp directory. chmod 4775 /tmp: This uses the octal mode representation, where 4 corresponds to the sticky bit (1000 in binary), and 775 are the standard permissions for the directory (rwxrwxr-x). Incorrect commands: A. chmod +s /tmp: This sets the setuid bit, not the sticky bit. C. chmod 1775 /tmp: This sets the sticky bit (1) but also the setuid bit (4), which is usually not desired for the /tmp directory. E. chmod 2775 /tmp: This sets the setgid bit (2), not the sticky bit.
The correct answers are: B. chmod +t /tmp D. chmod 1777 /tmp The sticky bit is represented by the octal digit 1 in the permissions, not 4 as I mistakenly stated.