- In this video, I will tell you about permissions
the basic permissions in Linux.
There's three of them.
We have read, we have write, and we have execute.
Now, when you are going to assign these permissions
using the chmod command,
you are probably going to use what we call the octal mode.
That's a number
and you are going to assign these numbers to ugo,
ugo, user, groups and others.
I'll tell you more about it later,
but I already want to give you the number.
Read is four, write is two, and execute is one.
Now, while assigning these permissions,
it is essential to understand
what these permissions are doing
on files or on directories.
Well, if you have read on a file, guess what you can do.
You're right, that allows you to actually read the file.
Read the file, in computer technology,
means you can open the file in memory
and do whatever you want to do with it.
And how about read on a directory?
Well, if you have read on the directory
that means that you can list files in that directory.
Now we have write.
If you have write on files
then you can actually modify your files.
If you have write on the directory
that allows you to add or delete files from that directory.
And that is something that you should remember.
Deleting files is a directory operation,
not a file operation, so you don't need permissions
on the file in order to delete it.
You just need permissions
on the directory that contains the file.
And last, there is execute.
Execute is a very important permission in Linux
because that's the permission that makes Linux secure.
Execute is what you need in order to run a command.
If you don't have execute permissions
you cannot run the file.
That is what makes Linux a very secure operating system.
And that's also the main reason why Linux,
you don't need any antivirus or whatever,
because execute doesn't come by default.
There is also execute on directories,
and that means that you can cd
and change into the directory.
Now, in order to work with permissions,
you need to assign these permissions to the owner.
Linux works with ugo, as I mentioned,
user, group and others.
User is the user who is owner, group is the group owner,
and others, that is everybody else.
And I will show you next how to do that.
So let me summarize what we have just seen.
Basic permissions is what it's all about
and you can set basic permissions to files
as well as directories.
And there are three basic permissions.
To start with, there is read, with the octal value four.
And read, if you apply it on files,
means that you can read the contents of a file
and on directories, it means that you can list
the contents of directories with ls.
Just make sure to understand that read on directory
does not mean that you can read any files in that directory,
because that is decided by the individual file permissions.
Next, there is write, write on files
means that you can modify the contents of the file
and write on the directory means
that you can add and remove files from the directory.
The thing to realize here is that
deleting a file is a directory operation.
So that means if you have write on the directory
you can delete it
no matter which permissions you've got on the file.
Next, we have execute.
Execute on files means that you run the file
if it contains executable code.
And if you have execute on the directory, then it means
that you can change into the directory using the cd command.
That's all.
In the next video, I will show you how to apply these.