The sticky bit can be set using the
chmod command and can be set using its octal mode 1000 or by its symbol
t (
s is already used by the
setuid bit). For example, to add the bit on the directory /usr/local/tmp, one would type chmod +t /usr/local/tmp. Or, to make sure that directory has standard tmp permissions, one could also type chmod 1777 /usr/local/tmp. To clear it, use chmod -t /usr/local/tmp or chmod 0777 /usr/local/tmp (the latter will also reset the tmp directory to standard permissions). In Unix
symbolic file system permission notation, the sticky bit is represented either by the letter
t or
T in the final character-place depending on whether the execution bit for the
others category is set or unset, respectively. For instance, on Solaris 8, the /tmp directory, which by default has both the
others execute bit and the sticky-bit set, shows up as: $ ls -ld /tmp drwxrwxrwt 4 root sys 485 Nov 10 06:01 /tmp If the sticky-bit is set on a file or directory without the execution bit set for the
others category (non-user-owner and non-group-owner), it is indicated with a capital
T (replacing what would otherwise be
-): • ls -l test -rw-r--r-- 1 root anygroup 0 Nov 10 12:57 test • chmod +t test; ls -l test -rw-r--r-T 1 root anygroup 0 Nov 10 12:57 test ==See also==