To change a folder or file's permission settings, you use the 'chmod' command. The arguments to this command are the permission setting -represented by a number- and the file or folder you want to change the permissions on.
Lets say for example, you wanted to change the permissions on all the files on your data partition that we just set up on the last page, you would tell it to change the permissions on the folder that contains the files, and you would tell it to execute the command RECURSIVELY with the '-R' switch. So this will affect the folder that contains all your files, then all the files inside that folder, then all the folders inside that folder, and then all the files in those folders, until it runs out of folders to go into and files to change. Here's an example command to change the permissions on all the contents:
chmod 777 /A -RThe first '7' tells chmod that the file's owner is allowed to read, write, and execute the files specified by the path argument. The second '7' is for the Group permissions, in this case 'group' is the group that the OWNER of the of the files belongs to. The third '7' is for everyone else. Play with the permissions below by clicking on them to get a better understanding of how they work:
| OWNER | GROUP | OTHERS |
|---|---|---|
| Read: 4 | Read: 4 | Read: 4 |
| Write: 2 | Write: 2 | Write: 2 |
| Exec: 1 | Exec: 1 | Exec: 1 |
| 0 | 0 | 0 |
If you right click on a file or folder, and go to 'properties', and select the 'permissions' tab, you will see many settings, but the ones i want you to notice are the 'Owner', 'Group', and 'Others' settings. The owner and group of the file can be changed if need be, but you'll never have to change 'others' as it refers to 'everyone' or 'no one' or 'anonymous'. In order to change a file or folder's OWNER and GROUP settings, type in the command below. You can also change these settings Recursively with the '-R' switch that i went into detail about earlier in the above section about permissions.
chown Alex:AlexGroupName /A -RThe first part -'Alex'- specifies the new Owner of the file. The second part -'AlexGroupName'- specifies the group who has group-permissions to the file, remember, the group permissions don't have to be the same as the owner permissions, as you'll notice in the permissions table above. The next part is the path of course, and we tell it to operate recursively under that path with the '-R' switch. Also note that your file/folder's owner does not have to be a member of that file's group.