chmod 1777 rwxrwxrwt

chmod 1777 (rwxrwxrwt): the owner can read, write and execute; group and others can read, write and execute, with the sticky bit. Commands and umask.

Octal
1777
Symbolic
rwxrwxrwt
ls -l shows
-rwxrwxrwt for a file, drwxrwxrwt for a directory
chmod letters
u=rwx,g=rwx,o=rwx,+t

Who can do what

ClassDigitBitsOn a fileOn a directory
Owner (u)7rwxRead the contents, change or empty the contents and run it as a programList the names inside, create, delete and rename entries and enter it and open files by name
Group (g)7rwxRead the contents, change or empty the contents and run it as a programList the names inside, create, delete and rename entries and enter it and open files by name
Others (o)7rwxRead the contents, change or empty the contents and run it as a programList the names inside, create, delete and rename entries and enter it and open files by name

Each digit adds read (4), write (2) and execute (1). Deleting or renaming a file depends on write and execute on the directory that holds it, not on the file's own mode. Root bypasses read and write checks.

Special bits

Sticky bit (1)
On a directory: only a file's owner, the directory's owner or root can delete or rename entries, even though others can write. Linux ignores it on files. Shown as t in the others' execute place.

Typical uses

The sticky bit plus 777: anyone can create files, but only a file's owner, the directory's owner or root can delete or rename it. /tmp and /var/tmp are 1777 on Linux and macOS, shown as drwxrwxrwt.

Security notes

  • Everyone can write here, which the sticky bit makes safe for a shared directory: users cannot delete or rename each other's files.

Commands

  • Numeric
    chmod 1777 file
  • Symbolic
    chmod u=rwx,g=rwx,o=rwx,+t file
  • Check the result
    stat -c '%a %A %n' file

The umask that gives 1777

No umask produces 1777: a umask only removes bits from 666 for files and 777 for directories, and it never sets setuid, setgid or the sticky bit. Set it with chmod after creating the file or directory.

Other common modes

Work out any other mode in the chmod calculator