Which of the following commands set the sticky bit for the directory /tmp? (Choose TWO correct answers.)
Click on the arrows to vote for the correct answer
A. B. C. D. E.BC
The sticky bit is a special permission bit that can be set on a directory in Linux. When the sticky bit is set on a directory, it means that only the owner of the file, the root user, or the owner of a specific file can delete or rename files within that directory. Other users can still create, read, and modify files in the directory, but they cannot delete or rename files that they do not own.
To set the sticky bit on the directory /tmp, we can use the chmod command with the +t or +s option, followed by the name of the directory:
A. chmod +s /tmp - This command sets the setuid bit on the /tmp directory, not the sticky bit. The setuid bit allows a program to be executed with the permissions of the program's owner, rather than the permissions of the user who is executing the program.
B. chmod +t /tmp - This command sets the sticky bit on the /tmp directory, which is the correct command to use to set the sticky bit.
C. chmod 1775 /tmp - This command sets the permissions on the /tmp directory to 1775, which includes the sticky bit. The first digit, 1, represents the sticky bit.
D. chmod 4775 /tmp - This command sets the permissions on the /tmp directory to 4775, which includes the setuid bit and the sticky bit. The first digit, 4, represents the setuid bit, and the second digit, 1, represents the sticky bit.
E. chmod 2775 /tmp - This command sets the permissions on the /tmp directory to 2775, which includes the setgid bit and the sticky bit. The first digit, 2, represents the setgid bit, and the second digit, 1, represents the sticky bit.
Therefore, the correct answers are B and C.