>_ IzzyLab

Hands-on task

This task is step 16 of the course “Linux: everyday tasks”

Shared directory with the sticky bit

easy~2 min

Create a /shared directory that everyone can write to, but where only the owner of a file can delete it. Permissions — 1777 (777 + sticky bit).

What you'll practise:
  • sticky bit
  • chmod
  • octal permissions
  • shared directories
  • mkdir

Topic breakdown

A directory with 777 permissions is a free-for-all: the right to delete a file comes from write access to the directory, not from owning the file, so anyone can wipe out someone else's. The defense is the sticky bit: a special bit on the directory that allows only a file's owner (and root) to delete or rename it inside; the classic example is the shared /tmp. In octal notation the sticky bit is the leading, fourth digit before the usual rwx triplets, it is set with the chmod command (numerically or symbolically via +t), and it shows up in ls -ld as a t in place of the x for others.

What's checked

  1. /shared permissions are 1777

What it looks like