Okay, for setting basic permissions, you can apply them to files. You can also apply them
to directories. And there's three of them. First, there is a read. Read is pretty easy
to understand. It allows you to open a file. And that means that you can, well, read it.
If you have read on a directory, that is maybe a little bit less obvious. It allows you to
list files. So if you want to use the ls command to see what exists in the current directory,
you need read on the directory. And then we have write. Write on a file is really about
modifying existing files. Now, some of the most confusing parts is write on a directory,
which is all about adding files or deleting files. And you should keep in mind that deleting
a file actually is a directory operation. So it requires permissions on the directory
and not necessarily on the file. Then we have execute. Execute allows you to run a file.
So that assumes that it is an executable file. It contains code that you can run. Execute
on a directory is kind of a specific one that allows you to use cd into the directory.
And for that reason, on directories, execute and read are always going together. Now, when
you are working with these files, you are going to use chmod. Chmod in the so-called
relative mode or in the absolute mode. And in the absolute mode, you use digits. Read
is 4. Write is 2. Execute is 1. I'll tell you all about these digits in an upcoming
video. Now, there is one permission that we need to specially investigate, and that's
special x. Sounds like a secret agent. How does it work? Well, when x for execute is
applied recursively, it would make directories as well as files executable. And you don't
want files to be executable when you recursively apply your permissions. That would be potentially
dangerous. Imagine that there's a file with dangerous code in there, and then unforeseen,
it becomes executable. That's undesired behavior. And that is why if you are using execute recursively,
you should use uppercase x, also known as special x. And the result is that directories
will be granted the execute permissions, and files will only get the execute permission
if it is already set elsewhere on the file. And otherwise, you'll get read and write.
In the next video, I will demonstrate how to manage permissions, and you will see how
special x is working.