nerdexam
CompTIA

LX0-103 · Question #63

Which of the following commands set the sticky bit for the directory /tmp? (Choose TWO correct answers.)

The correct answer is B. chmod +t /tmp C. chmod 1775 /tmp. The sticky bit on a directory prevents users from deleting or renaming files they do not own, and it is set using either the symbolic '+t' flag or the octal prefix '1'.

GNU and Unix Commands

Question

Which of the following commands set the sticky bit for the directory /tmp? (Choose TWO correct answers.)

Options

  • Achmod +s /tmp
  • Bchmod +t /tmp
  • Cchmod 1775 /tmp
  • Dchmod 4775 /tmp
  • Echmod 2775 /tmp

How the community answered

(44 responses)
  • A
    2% (1)
  • B
    91% (40)
  • D
    5% (2)
  • E
    2% (1)

Why each option

The sticky bit on a directory prevents users from deleting or renaming files they do not own, and it is set using either the symbolic '+t' flag or the octal prefix '1'.

Achmod +s /tmp

chmod +s sets the setuid bit on files or the setgid bit on directories, not the sticky bit.

Bchmod +t /tmpCorrect

chmod +t /tmp uses symbolic mode to add the sticky bit (represented as 't' in ls output) to the directory, leaving other permission bits unchanged.

Cchmod 1775 /tmpCorrect

chmod 1775 /tmp uses octal notation where the leading '1' encodes the sticky bit, '7' grants rwx to owner, '7' to group, and '5' (rx) to others - a common real-world setting for /tmp.

Dchmod 4775 /tmp

chmod 4775 sets the setuid bit (leading octal digit 4), which causes executables to run as the file owner, not the sticky bit.

Echmod 2775 /tmp

chmod 2775 sets the setgid bit (leading octal digit 2), which causes new files in the directory to inherit the group, not the sticky bit.

Concept tested: Setting the sticky bit on Linux directories

Source: https://man7.org/linux/man-pages/man1/chmod.1.html

Topics

#sticky bit#chmod#special permissions#directory permissions

Community Discussion

No community discussion yet for this question.

Full LX0-103 Practice