nerdexam
CompTIA

LX0-103 · Question #155

The sticky bit is usually set on

The correct answer is B. /tmp. The sticky bit on a directory restricts file deletion so that only the file's owner can remove it, even if other users have write permission to that directory. /tmp is the canonical example because it is world-writable and shared by all users.

Devices, Linux Filesystems, Filesystem Hierarchy Standard

Question

The sticky bit is usually set on

Options

  • A/var/log
  • B/tmp
  • C/home
  • Dlog files

How the community answered

(34 responses)
  • A
    6% (2)
  • B
    85% (29)
  • C
    6% (2)
  • D
    3% (1)

Why each option

The sticky bit on a directory restricts file deletion so that only the file's owner can remove it, even if other users have write permission to that directory. /tmp is the canonical example because it is world-writable and shared by all users.

A/var/log

/var/log is typically writable only by root or specific system accounts, so the sticky bit protection against arbitrary deletion is not needed or conventionally applied there.

B/tmpCorrect

The /tmp directory is world-writable (mode 1777), meaning every user can create files there, but without the sticky bit any user could delete anyone else's files. The sticky bit (the leading 1 in 1777) ensures that only the file owner, the directory owner, or root can remove a file, preventing one user from interfering with another's temporary data.

C/home

/home contains per-user home directories owned by individual users; since other users do not have write access to a user's home directory by default, the sticky bit is not required.

Dlog files

The sticky bit is a directory permission concept; applying it to individual log files has no practical effect in modern Linux kernels.

Concept tested: Sticky bit usage on shared writable directories

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

Topics

#sticky bit#file permissions#FHS#/tmp directory

Community Discussion

No community discussion yet for this question.

Full LX0-103 Practice