Who can do what
| Class | Read (4) | Write (2) | Execute (1) | On a directory |
|---|---|---|---|---|
| Owner (u) | Yes | Yes | No | List the file names, but not open them. |
| Group (g) | Yes | Yes | No | List the file names, but not open them. |
| Others (o) | Yes | Yes | No | List the file names, but not open them. |
When to use chmod 666
Lets everyone read and write the file, but nobody execute it.
Rarely a good idea for files on disk, since any user can change them. It is the default that umask trims down for new files (to 644 with the usual umask of 022), and it is normal for device files such as /dev/null.
Commands
Set the mode with octal digits, or with the equivalent symbolic form:
chmod 666 path/to/file
chmod u=rw,g=rw,o=rw path/to/fileTo 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 666 {} +chmod -R 666 changes files and directories alike, which is rarely what you want: directories usually need execute, regular files usually should not have it.