chmod 777 (rwxrwxrwx) explained

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

Octal
777
Symbolic
rwxrwxrwx
ls -l shows
-rwxrwxrwx

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 777

Gives everyone full access: any user on the system can read, change and run the file, or create and delete files in the directory.

Almost never the right answer. It is the usual "fix" for a permission error and a common security hole: any account or compromised process can modify the file. Find out which user needs access and give it to that user or group instead, typically with 755 or 775.

Commands

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

chmod 777 path/to/file
chmod u=rwx,g=rwx,o=rwx 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 777 {} +

chmod -R 777 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