Now, let's put this command and you can see that we have the long list format.
Now it's time to talk about all of this.
Well, actually, not all of them.
First now let's talk about the first part, which is that this part and what is this?
What is this?
OK, now you can see that we have the first part, which is this.
Now we have this symbol, which is the or this letter D or minus dash, let's say, or sometimes it's
and or something else.
What are those?
Well, actually, this is the type of the file.
So the here as you can see, they are one remoting.
These are the deed which means directly.
OK, now the splashier sorry, the decir as you can see here for this or they stick to your text file
or this too.
These are a regular file.
OK, now if we have a list, so let's have a directory so linked to, to there to anything it's OK.
It's as a symbol or as a symmetric.
Now if we have it again now we have an OK, now this is just arbitrary link.
OK, so now we have an L means a link fight.
OK, now actually there are other files like bypass which are a lot of things you can read about it,
but these are the most important ones.
The directory, the text files.
We have the files or link list funds.
OK.
So far so good.
Now it's time for the BATO, which is these bits.
Now what are those?
As you can see, we have read, right?
Execute, read, write, execute.
Or are they are they are the.
What are those actually these are four that read and execute are for beautiful.
Right.
X for execute.
But we have, we will have them duplicates.
What are those.
Please read, write, execute then we have read, write, execute and then we have a third rewrite execute.
Now actually these are for the user which is the owner of the file, which is Open-top in my case here,
the group, the second three bits, which is for the owner group or the group for this file or this
directory, which is in my case as well.
It is Ubuntu and we have the read write execute the third bits, which is for that others.
Others, which means that any other user or group on the system can have either read, write or execute
or the three, the three of them which is written to execute in my case.
So anyone in the system can read and write and execute on this directory, which is something that I
know.
But just for me, by the way, they wrote that actually doesn't have this permission only for the owner,
which is the owner, not even for the group, not only for the owner, which is something more secure
because only the road user can do whatever it wants with this specific secret file.
OK.
All right.
Now, I want you to follow me now.
How to change that permission for this file.
OK, we have to do we will start testing on the dire one.
OK, or actually let's have on t the text, OK.
The first thing I want to remove the key to the text because they are a linked list actually, so we
don't need to get confused here.
So unless nationally or we can have this one.
That is the text.
OK.
All right.
Now for changing the user mode, we need to use that segment, which is change mode.
OK, g change mode.
We have two ways of changing the one we have the binary mode or the number number or we have the second
way, which is the letter.
OK, using that Hugo.
OK, now we would hand.
What if we.
So don't worry.
So the first thing let's have search mode then we provide that permission here.
OK, then we put the name of the file which is the text in my case.
OK, now what are the permission I would want or I will start with that numeric way or the numbers.
OK, now I would put a binary value translated from that integer.
To get what we want.
OK, now, again, we have for the user and work for the group and for the other user, which is the
owner of the pipe.
OK, sorry for this one.
OK, so the first part, which is very dry, execute for the owner.
Now the Reid.
It will give you for follow me for the right, which is the bit, it will give you two and they execute,
it will give you one.
So it will be start from here one to four.
So depends on what you want calculate and some of the permission you want then.
But the value.
So for example, I wanted to be read, write, execute so I will some one plus two plus three plus four
which means four which means seven.
Four plus three which means so seven sevens mean read, write, execute.
Now this is for the owner.
Now let's start with that group which is read right.
Execute another thing I need to bet I need it to be read execute only so I will calculate or I will
some one plus four which is read and execute.
Execute is one.
Right is to read is four.
OK, so four plus one which means five.
So it will be fine.
Now for the last part, which is the other part, I want it to be zero, which means no read not I have
not executed.
OK, so it will be zero so it will be seven hundred and fifty.
And now if I type it like this and if I type as well.
And let's have a comparison between this one and this one so you can see that here we have read write
without execute, which means dash.
Dash here means no but has been set which means no execution here.
No right.
Fit on here, no execution bit.
But here after we done it, now we have read that I can execute so you can see that execute has been
added, read, executed only, which means that execute has been added and the right has been removed.
And we have that and that.
Oh sorry Dash.
That's Dash, which means no permission at all for the others.
But so you can see comparison with here.
We removed the grid as well.
All right.
So far so good.
Now this is the first method.
Now it depends on you what you want.
So read, only write, only executed, only read, executed, read, write, execute, write, execute,
write with read, read with only execute only whatever you want, whatever you want.
Depends on that.
But with the permission you want.
Five five five for example.
And the name of the file you want to change the permission for.
OK, ok now this is the first way OK.
And again, not just the second way which is using the letters way now we would have there you go.
Which means user group either on Hulu Plus minus Equant and then provided that I execute OK and we have
the S but the US, which is the special permission, we will talk about it later on in this lecture.
Don't worry.
All right.
No, actually, this is the most prepared way that everyone use it.
They will not use the binary way they use this way because this is much readable, human human readable,
actually.
And actually, from my opinion, I use this again, it depends on what you prefer and so on.
So, yeah, you prefer that way.
You are used to that way it's OK or you want to get used to that way it's OK.
But from my opinion, it's better to have as simple as possible because when things go down, when you
are for example, you are a database engineer on this company and this company servers is going down
and you want to change information or you want to do something.
So it's better to have a simple approach because the errors or the human errors will be less than when
combat is if you are using a complex week.
OK, well, actually this is my opinion.
After all, you choose what you want.
OK, now let's start for example.
Now let's see.
Have this fight.
We have read, write, execute, read, execute, and we have nothing for the other.
So, for example, I want for the user to have the right to execute and the group to have read execute
and the other to have execute.
No, actually I will I will talk about it this fast.
So the first thing that you and G and or equal read, write, execute.
So this will give you as you can see, we have equal, we have plus, we have minus here plus at minus.
Remove this equal.
It would be absolute like this.
So t the text file which is the name of the file sort of this.
Yeah.
So see what the user or the owner, the group and other equal rights to execute and let's have it here.
So if I type special you can see that this time it is read, write, execute, execute, read, write,
execute.
All right.
Now actually we can have it again which is sigmoid Euge all this time, minus read, write, execute
as you can see.
And what the T of the text which is this time the user and the owner, the group remove the read and
write and execute.
So let's put it like this.
And as Deshotel And you can see that the t the text file has no permission at all.
All right.
So far so good.
Again, see Etemad Ugelow plus read execute or without special.
Plus, execute to the text file.
OK, so this will give us only read right for everything, which is this one.
It's clear the screen and let's have another look what actually instead of using that or because you
are, I think to everyone.
To all you use.
Oh, a I mean it equal read.
Right.
Execute to the to the text file.
OK, now let's have a look here.
It means all everyone.
So they use the group the order.
So if you look here.
Yeah.
This time instead of rewrite only it would be read, write, execute, execute, read, write, execute.
So far so good.
For example, if you want the other to be nothing.
OK, so you can just the other minus read, write, execute the text.
So this would remove the read and write and execute from the text file so that I forget about the statement
here.
Sorry.
Yeah.
I thought it would be no read.
No right.
No execute as simple as that.
And if I type it here you can see that it is very simple.
No actually it is better.
I will not tell you every situation here or in the case, but it's better to have a real hands on.
Please open your terminal, get your hands dirty and try everything possible for your this temporary
device, whatever.
Fine you have now.
Enough with that.
Let's talk about another subject now.
I want to talk about what is the difference between the directory and the regular file as read or write
or execute.
Execute.
So as I read, yeah, the text file is readable.
So let's have a comparison between the text and let's make a directory, name it Dir and S, for example,
or dial one.
But for that it's removed and remove that one.
And they still move there as well, and this would get Ashara, so unless this all this time we don't
have them, so let's remove their tube as well.
So you can see that we don't have them, let's make an directory and it's name one, OK, so it has
to have a here look, you dial one and we have to text, OK?
No, for that file or the regular file, which is text readable, it means I can concatenated I can
I can open it using any text editor.
OK, so you can see that it can be readable.
So if I take the text, you can see that we have this arbitrary lines or arbitrary text, whatever.
OK, but if I removed that permission from everyone, which is all my notes are OK, I will remove the
reading permission by the way, you can instead of a minus R, you can put just minus R and the T the
text.
This will work as well.
OK, so if you have a look here, nothing is readability.
The text is no treatment.
So t ditech the text, permission denied.
Even though you can see that I am the owner of the file, you can see that I am the owner of the Y by
the way.
This will not work on the user.
So if I type Sue Cat and don't worry about this, we will talk about it in a separate lecture and full
details about the pseudo what is.
But for now, keeping your mind, Sudo is used to run specific commands as another as another user,
which is in my case, as the rule is.
So I'm running the cat as the full permission user, which is the root user cat t the text.
You can see that even though you can see that no one has read but enabled, you can see that root the
root user, which is by you doing this command, is able to read the file because this is the user,
which means the full permission user can read anything, can do anything, is the owner of the system.
So that's why it's very dangerous to have him or to have this user compromised.
Anyway, it's let's turn back.
All right.
So we saw what means the need for the search mode.
Again, let's but please increase the read for the text or a t the text.
It's OK.
Read for the text.
It's OK.
It will do the job.
But it's clear the screen and again now this is read before the fight for the right to fight, it is
the same so I can write content to this fight.
By the way, this is the beat on the other.
The owner of the group or the other.
So if I have for the owner, right, but without right and on the group I have as I write for the others,
I have it as right when actually the owner will not be able to write it on the file, but the others
will be able to identify it.
By the way, this is this doesn't make sense.
I know, but just keep that in your mind.
OK, so for regular text file to redefine the right tool, write to the fight or modify the fight and
execute if you want this fight to be executable.
So you are writing about your script by the script BHB, whatever.
So you want it to be executable.
OK, now this is the first thing.
Fought this fight, but fought a directory.
OK, this is different now, so, yeah, it is very simple.
You can read the content of the directory, which means what are the directory inside it?
What are the regular parts inside and so on for the right.
Very simple.
You can modify the directory so you can create new directories inside that you can identify its name,
by the way, in which by which means file its name and modify the content either in a regular order.
OK, and we can create a text file inside this directory, which is the right of it, which means this
data is right.
But finally, what is the execute bit for the directory?
We know that what is what it is for the regular schedule of by, which means this fight is executable
to execute commands that script both and whatever.
But for the directory, the executable actually is go inside it.
So execute a specific directory means I can go inside this directory.
Now, let's see.
Have this year.
So let's have sigmoid execute, let's remove the execute from everyone on that one.
OK, so I'll ask Deshotel now we don't have any execute permission on this one.
So if I try to go inside it, even though I am the owner of this, you can see that permission denied.
All right.
So even if I type S, by the way, you can see that it is readable for everyone where it is here.
Yeah, it is readable for everyone other on the group, whatever are one.
You can see that I am able to read what is inside it, but I cannot do or create anything inside it.
So if I create the directory or let's create a text file or anyway let's create a directory inside it,
so let's name it down too.
But this time we want it to be inside that one.
So yeah, you can see that their mission is the.
Why is that actually even though I am I the owner which is open to as you can see, I am open to it
and I have the right permission.
You can see even my group have permission, but you can see that because I am not able to go inside
because actually under the hood that command what is this command do actually is go inside the directory,
which they are one.
And then we create a directory called diatom.
So that's why I, I can't I don't have the permission to go inside the dial one.
OK, again, by the way, if you are using the swedo or the root command sorry, the SUDA command with
the route permission and privilege, you are able to do whatever you want.
OK, because this is the king on the system.
It will, it can do anything you want.
All right.
Now we have talked enough about the permission.
Now, we didn't talk anything about how to change the owner or the group of this file.
OK, actually, we have two commands.
We have the cat on.
This is to change either the owner or the group, by the way, or the group and the owner.
And we have that change grb, which is change group, OK, and this is to change the group of this file
or directory.
OK, let's try have a hands on real quick, so on.
So this time I will choose another user name artist, for example, change owner just to the the text.
But maybe this will not work because actually the test is not a real user actually.
So I want to change it this time for the root user.
OK, so I brought.
You can see that operation that's permitted.
Yeah, how can you change it to a route which is the computer?
So you can't do that actually, so you need permission for that and you need for that.
You need to provide the document.
OK, and by the way, I have this shortcut for you.
So instead of taking this and type the document, you can type the pseudo shift one one, which means
the exclamation mark.
And here to run the previous command, which is this one, which is a strange route to the key, the
text with pseudo permission.
And if I type it here, you can see that, yeah, it worked fine, which is and it print what is the
previous command, which is pseudocyesis en route to the text.
And here.
Yeah, you can see that t the text.
Now as you can see here previously it was, it was 012 but here it is.
What.
So if I try to read it or do whatever I want, so actually maybe I can because I am the group after
all.
Here you can see that I am inside the group that I went to group anyway.
Who cares?
It's say.
Yeah, you can see that I am able, even though.
And the owner is the old, but maybe because it is you have other permission to read the file anyway.
No, nobody.
Now, what if I want to change?
It's clear the screen first.
I want to change the owner and the group or the group.
So see the grb and brought.
By the way, every user created on Linux has a group.
So I want to use up have a group called Ubuntu Group as well.
OK.
So road user has a road group as well.
So she wrote Kenja group, as you can see, a change group wrote for the team that X, Y and course
we need a permission.
So so pseudo shift one, shift one, which is exclamation mark.
And yeah.
So I type it like this.
You can see this time that honor is brought and OK, now what if I want to change this route and the
group route with one command.
I don't need that.
So actually I need to provide so we don't see it on this time.
But you may ask me how to do that.
Yeah, actually, you put the name of the user.
We already saw that.
And in my case I wanted to be open to our youth.
But now they could then provide the open talk as well to the text, which is the name of this would
change the owner, which is the user and the owner group, which is going to and actually in my mission,
from my opinion, it's better to have Cichon because it is much newer than the GRB.
But it depends on you what you prepare.
Everything would work.
No performance here, nothing security.
It will do.
It's just your preferences.
OK, so let's have a look here.
Yeah, yeah.
You can see that I am able now to change the owner and the group of the ti the text and it worked fine.
OK, now we have another command which is the idea.
So actually id here if you can see if I type it, if I type meant ID because it will print the real
and effective user and group ID of the current user.
So the current user I have, which is Ubuntu if I type ID, you can see that this is the user ID.
Which is one thousand, this is the guide, which is 1000, the groups I am in, which is open to and
this is the idea for it.
As you can see, um, here are some of the information from some of the groups.
I am inside that so you can see that I am inside the pseudo group.
Don't worry about this.
Do it.
We would have a detailed lecture about it.
Don't worry at all.
And here are some of the other groups for the system.
Actually, it doesn't matter.
OK, so you can see that by typing the ID we know what are the group?
The window is inside, which is a window adiam.
They are allowed whatever CD flow should so pseudo, which is something very important.
We will talk about it.
Don't worry about things.
OK, now until we have another commands, which is the groups.
So you can see that we have the groups like this.
So you can see it will bring not only the groups that user or the current user, which is open to it.
My guess is in which is open to at the end and oh Khedive lobby.
So the pseudo audio blah blah blah, whatever.
OK, all right.
So far so good.
Now one last thing I want to mention here in this lecture.
I know the lecture took too long time, but actually these are the most important things in in the 9x,
which is the permission when the most important one of the most important or.
Right.
So which is the special permission.
OK, so let's clear this came first and as now for the special permission, actually.
We have three special permissions, the ASU idea or visit your user ID, that idea, which is the city
guide, and we have the sticky bit, which is the sticky bit for the directress only.
Now, let's have a look.
Don't worry, we have that indicates now the first thing actually how to implement or how to apply these
permissions actually using something we already use, which is the statement.
Yeah.
And you need them for this point, which is the text.
And we need to move forward for user or group or other.
Let's use them for all.
So all equal or less but less which means increase that.
OK, we already learned that.
I'm assuming that you are familiar now with the sigmoid command.
Now this time I will not use, read or write or execute this type of use special that are called s either
small or small.
Now as it starts with the S first, then we will go that don't worry the S which means the special permission.
OK, which means the special permission for that they're sold or that that group ID, so I guess as
to the Teda text, now you can see that we have them here if I type it.
Yeah, you can see that it is now red highlighted in red and you can see that there are us, not Ardebili.
It's you can see previously it was Ardipithecus and now it is right there with us.
And again it is red.
Right.
Execute for the group and here it is red.
Right s which means suspicion.
Right now you can see that it is small while it is small.
What is the difference between the small and the capital now that small, which means the execute bit
is set, which means that this group is executable and it has the special permission.
OK.
And here, the same thing for the user, which means that special permission is set and it has the executable
enabled for the owner.
Now, what are actually actually what are that special permissions?
Now, to be honest, the special commission is as simple as that, it is just run this fight and actually
it's better to have an executable fight, to be honest, not for a regular phone or I think it's fine
just to read or write.
No, actually, these are worked, actually.
Exactly that you case for the executables fights, either executable files or executable entries.
So executable fights in my case.
Let's imagine I have a bash script here or Python.
So which means run this fight as the owner, which means as that privilege of the owner.
So imagine if this is a road owner and run this fight as a as the owner, which means I'm in this fight
as a rule, which means this is a very huge security breach.
Or in the other hand, it is something you already used for this purpose.
OK, so you need to be careful here because this is something dangerous.
If the owner is right, you need to be careful here.
OK, so cat, so this means that anyone can execute this as the root, which means it has the privilege
of executing what commands, which means you compromised the whole system, which is something very
dangerous.
Now for the group, it is the same.
You can see that we have it here and which means run this fight the executive and let's imagine it is
a bad script.
OK, run this script and that group owner, which is not the owner only or as a group.
So which means that it will run first as owner and it will run as a group as well.
OK.
By the way, there are precedents here.
The first precedent for the owner, then the group, then we have the other.
OK, now you can see that on that other part or the other executable here.
It is not right now, but before that, let's put the same command which is er plus s but this time
I would what s capitán which is as this.
You can see that er give me a ok now if I blis minus it will give me your.
OK, so how to do that which is minus X minus from T from everyone.
If I type it like this, if I type S dash and this time you can see that now it is s capital not as
small which means the executable bit under it or inside it is set to off, which means it is Desh like
this here.
But previously you can see that it is a small but now it is Surbiton which means X capital.
The executable for the group or the owner is to know or sit to an all or no executable which are enabled.
Now the last thing let's talk about the sticky bit and actually this is only work on the directress.
OK, so how to do that sigmoid er assume it's er plus now this that I would not use this time I would
use t by the way a T capital would not work as this as well here inside this excitement.
So you need to remove the executable bit from it.
OK, so let's add that sticky bit sticky bit for the Dir one and let's have a look here.
Oh, cool, so you can see that now it has.
And by the way, it is the capital, as we mentioned previously in this case here, as you can see,
which means that the executable bit is set to zero or none, which means that no executable with you.
OK, now if I type at mode, let's say other plus executable and we want for it for the one.
And let's have an additional.
You can see that it is not capital this time.
It is too small, by the way.
And again.
What are the sticky bit we already learned, what are that?
And as you ideologized, which is for the user or the group and actually these are for the directory,
for the regular part, actually, for the security, but fine as well.
But for the sticky bit, it is only for directress.
And this means that only the root user, which is the user or the owner of the fight, can remove this
fight or this directory.
Actually, this is only work for the victims where it is.
That is the system you can see if you go to the temp directory.
So actually it is clear the screen and SSL for the temp directory, you can see that we have it here.
So you can see that I need for the temp directory itself, so if I type it like this, actually you
can see that it has the T machine, which is the sticky bit, and it is executable because it is pretty
small.
OK, so this means that only the root or the file owner on this directory, which is let's have a look
here.
Actually, it's good.
So which means, for example, this fight only the matter user for this fight, only the wealthy.
By the way, it is the road only for this fight.
Only the Ubuntu user can remove this directory or does that of t only the matter can remove this directory
ordered, by the way.
And here the same thing for that one to matter.
OK, so this is what sticky bittar.
Sorry for the long lecture, but actually it is very important, if you didn't understand, you can
ask me a question or you can read that theory, but again, you will understand everything there.
Thanks for watching.
I will see you in the next lecture.