chmod 1777 (rwxrwxrwt) explained

The owner can read, write and execute; the group can read, write and execute; others can read, write and execute.

Octal
1777
Symbolic
rwxrwxrwt
ls -l shows
drwxrwxrwt

Who can do what

Class Read (4) Write (2) Execute (1) On a directory
Owner (u)YesYesYesList the files. Enter it and open files inside. Create, rename and delete files.
Group (g)YesYesYesList the files. Enter it and open files inside. Create, rename and delete files.
Others (o)YesYesYesList the files. Enter it and open files inside. Create, rename and delete files.

When to use chmod 1777

Gives everyone full access, plus the sticky bit: in this directory, users can only delete or rename their own files.

The mode of /tmp and /var/tmp. Everyone can create files there, but nobody can delete someone else's. Use it for any shared drop directory.

Special bits

  • Sticky bit (1): in a directory, only a file's owner (or root) can delete or rename it, even if others can write to the directory.

Commands

Set the mode with octal digits, or with the equivalent symbolic form:

chmod 1777 path/to/file
chmod u=rwx,g=rwx,o=rwx,+t path/to/file

To apply it to every directory below a folder (and not to the files), combine it with find:

find path/to/folder -type d -exec chmod 1777 {} +

chmod -R 1777 changes files and directories alike, which is rarely what you want: directories usually need execute, regular files usually should not have it.

Work out any mode in the Chmod Calculator