What command is used to add a sticky bit to a directory?

Disable ads (and more) with a premium pass for a one time $4.99 payment

Boost your Linux skills with the CompTIA Linux+ Certification Exam simulator. Engage with multiple choice questions and detailed feedback. Master Linux concepts and prepare for your exam with confidence!

To add a sticky bit to a directory in Linux, the command typically involves modifying the permissions of that directory using the chmod command along with the sticky bit notation. The sticky bit can be represented with the letter 't' in the symbolic notation, which is why the correct answer involves using the '+t' option.

When the sticky bit is set on a directory, it changes the way files within that directory can be deleted or renamed. Specifically, when the sticky bit is active, only the file's owner, the directory's owner, or the root user can delete or rename the files within that directory. This is particularly useful for shared directories such as /tmp, where multiple users may have files, and it prevents users from inadvertently deleting each other's data.

The other options do not correspond to any valid method for setting the sticky bit in the context of directories. The '+s' option typically refers to setting the setuid or setgid bits, the '+d' option does not represent any valid permission setting, and '+r' refers to adding read permissions, which is unrelated to sticky bits. Understanding the role of the sticky bit is essential for managing permissions effectively in a multi-user environment.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy