File permissions · modechmod 1777rwxrwxrwt

What chmod 1777 (rwxrwxrwt) means, who is allowed to do what, and when these permissions are used: /tmp: everyone writes, only the file's owner deletes.

Open in the calculator
Class by classdirectory
7
Owner
List the files, create and delete files, enter it.
7
Group
List the files, create and delete files, enter it.
7
Others
List the files, create and delete files, enter it.
When and why

Writing is open to all, but the sticky bit forbids touching other people's files. Without it a shared directory lets anyone delete anything.

World-writable
Any user can create and delete files here. If that is intended, add the sticky bit, the way /tmp does.
The sticky bit softens the risk
Everyone can write, but only the file's owner can delete or rename. That is how /tmp works.
Mode
Octal1777
Symbolicrwxrwxrwt
ls -l linedrwxrwxrwt
Command
chmod 1777 directory
01

What breaks

Other people's files vanish from a shared directory

rm: cannot remove 'notes.txt': Operation not permitted

Deletion is granted by the directory, not by the file: in a 777 directory without the sticky bit any user deletes and renames other people's files. With sticky set, deleting someone else's file is refused, as above. Checking is easy: ls -ld /tmp should show drwxrwxrwt, and the trailing t is the sticky bit.

02

Easily confused with

777rwxrwxrwx

the same without the protection: anyone can delete anyone's files.

chmod 777
775rwxrwxr-x

only the group writes, not everyone — the usual choice for a team.

chmod 775
755rwxr-xr-x

when outsiders do not need write access at all.

chmod 755
03

Commands for this case

chmod 1777 /var/tmp

a shared directory with the sticky bit

chmod +t /srv/shared

add sticky to permissions that are already set

Work out other permissions

The calculator opens on this mode: checkboxes, octal and symbolic notation, an ls -l line and the ready command.

Open the calculator on this modeAll common modes

Updated

«» added to favorites