Ubuntu – CHMOD 777. In terminal, the command to make all changes affect every file and folder

chmod

I am typing this:

chmod 777 /home/to the destination ...

image

But all locked and what I want to do is to make all files and folders to have read and write permission without doing each file/folder separately.

Best Answer

Giving files a 777 permission is absolute overkill, mind that you give with this your user full access, the user group full access and all others. So from a security standpoint this is a horrible solution.

Permissions are octal and each number represents what you can do with the file:

Number  Permission Type       Symbol
------------------------------------
0       No Permission         ---
1       Execute               --x
2       Write                 -w-
3       Execute + Write       -wx
4       Read                  r--
5       Read + Execute        r-x
6       Read +Write           rw-
7       Read + Write +Execute rwx

So it is definitively enough to give your user full and the group and others limited access (i.e. 755).

To do this recursively you can use the -R flag and the -v flag to get a verbose output of the action. So the line you search for is:

sudo chmod - Rv 755 /path/destination

See here and here for further reading into.