chmod 777 rwxrwxrwx

chmod 777 (rwxrwxrwx): the owner can read, write and execute; group and others can read, write and execute. Typical use: nothing, almost always a mistake.

Octal
777 (also written 0777)
Symbolic
rwxrwxrwx
ls -l shows
-rwxrwxrwx for a file, drwxrwxrwx for a directory
chmod letters
u=rwx,g=rwx,o=rwx

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.

Typical uses

Everyone can read, write and execute. It is almost never right: any user or compromised process on the machine can change or replace the file, and in a directory can delete or swap any file. For a shared directory use 1777 (sticky bit) or a group with 770 or 775. "Permission denied" errors are better fixed with the right owner or group.

Security notes

  • Others can write: every user and every process on the machine, including a compromised web application, can change or replace this. For a directory, they can delete or swap any file inside it.

Commands

  • Numeric
    chmod 777 file
  • Symbolic
    chmod u=rwx,g=rwx,o=rwx file
  • Check the result
    stat -c '%a %A %n' file
  • Directories only, recursively
    find /path -type d -exec chmod 777 {} +

Avoid chmod -R 777 on a tree that holds files as well as folders: it makes every file executable. Use the find command above for directories and a file mode such as 644 for the files.

The umask that gives 777

  • umask 000: new directories are created as 777 (and files as 666)

Programs create files with 666 and directories with 777, and the umask removes bits from those. A umask never adds execute to a new file, and it cannot set setuid, setgid or the sticky bit.

Its file counterpart is chmod 666 (rw-rw-rw-).

Other common modes

Work out any other mode in the chmod calculator