We've just seen that permissions have different effects on files and directories. 1
If you want to recursively set the permissions of all files to a specific value, then you should somehow 2
exclude the directories in the path. 3
If not, the directories will have the same permissions as the files. 4
And this is not good. 5
Just imagine a directory that has only the read and write permissions. 6
It will be unusable. 7
So I cannot simply run something like chmod -R 640 ~ tilda being 8
my home directory. 9
It will change the permissions of both the files and the directories. 10
And I just wanted to change the files permissions. 11
The solution to this problem, which, believe me, it is a very common one, is to combine, find and 12
chmod together. 13
You search for a file or a directorate type and execute chmod with different values for each type. 14
In the next example 15
I'll set the permissions of all the files in my home directory to 640 and the permissions 16
of all directories to 750. 17
First, I'll find all the files in my home directory, so find home directory type f. 18
Sorry, - type of. 19
These are all the files. 20
And then I write: exec chmod the permissions 640 21
{} 22
\; we have discussed this structure in the lecture about find. 23
Take a look there if you feel the need. 24
The pair of curly braces represents the file found by find. 25
And backslash semicolon ends the command that needs to be executed. 26
Take it as the syntax! 27
And it changed the permissions of the files to that value. 28
Well, I've got some permission denied errors because there are files owned by the root. 29
I have created them in the previous lectures, for example, o this one, you see, it's owned by root 30
and the non privileged user student cannot change its permission. 31
Now, I'll change the permissions of all directories to 750, so the same command just I 32
have type d, I'm searching for directories, and the permission value will be 750. 33
Now, all the files in the home directory have 640 and all directories 750. 34
And you'll see the file's permissions,640, and the directory 's permissions instead of type f 35
I write type d and their permissions are 750.