If you have already created a file or directory and needed to change the security settings on it.
If you have different utilities for this purpose are available in Linux, the section and this whole
lecture, you will learn how to change the existing permission, the default owner and the default group
settings for a file or directory.
So my name is Stephan, the complainant or lecturer of our course.
Let's get started.
The mode command allows you to change the security settings for files and directories.
The command mode here.
So the command format is like this.
So firstly you're going to enter the mode.
Then options came here.
Actually, let's hope.
Let's use the marker here.
So firstly you need to enter the c h mode.
And after that after mode, you will operate the options.
Options.
And after that you will enter the mode.
And after lastly is file that you want to change the comments and permissions on it.
So in order to do that.
The mode parameter here actually.
Oops.
Yeah.
The mode parameter allows you to set the security settings for either octal or symbolic mode.
So the octal mode settings are pretty straightforward.
So just use the standard three digit octal code that you learned in previous lecture.
Remember this here?
Yeah.
Remember this.
This is the permissions and your descriptions in binary and octal.
So if you want to make something like let's create a new file, you know, and torch my new file, we
already have my new file.
Or let's actually my ultra new file.
Yeah, my ultra new file.
And here, let's actually la my ultra new file.
And as you can see, this is following permissions right now.
Right.
Actually, let's open a new here and copy this and make examples from it here as so as you can see,
here we have.
This.
This is just.
We will ignore it at, uh, you will you learn actually this in previous lectures that this is a file
types.
So in this case it's just a regular file.
So we will ignore it and we will copy this.
We will ignore it.
First character.
Copy this.
Actually, let's go.
Here.
So now.
That's it.
Now I will show you right here.
So, as you can see here.
RW is.
RW is 110 then.
Here are minus minus our null null here 101 hundred again.
So after that, in octal, actually we are seeing the six.
Zero zero.
So that the permission for this file is my ultra file.
Is this right?
In octal and here in permission.
Here.
So.
As I said, the mode parameter allows you to set the security settings using either octal or symbolic
mode.
So in order to change this here, for example, mode six, let's actually use 760.
And here let's see what this 160 is.
So seven is rw x, then it comes six RW And after that zero is 000 and that's it.
And so let's see, what is this in?
A binary.
So 111 rw is 110 and 000.
Right.
Yeah.
Here.
And after that it is.
760.
And this is going to be my ultra file, the new my ultra file permission and this new permission.
Here.
Now let's use this mode.
Then your permission and then file or directory name.
In this case, my ultra new file.
And here, let's run it again.
And that's it.
As you can see here, we got the desired result here.
So let's see.
Let's compare these results here.
As you can see here, these are exactly the same result.
So this table will help you in order to use that.
So the Oakdale file permissions are automatically applied, applied to the file indicator.
So the symbolic mode permissions are not so easy to implement.
So instead of using the normal string of three sets of three characters, the Mod command takes a different
approach.
So.
In order to do that.
Here.
So in this mode, firstly you're going to enter mode and then ugoa here.
Yeah, this doesn't make sense, but you will understand here.
So ugoa here.
And after that plus minus or equal, you will enter one of this characters and after that you have this
rw x uppercase to go.
So you will enter one of those here.
This doesn't make perfectly good sense, right?
So the first group of characters defines to whom the new permissions to apply.
That's actually UJO are not like that.
S t ug o.
And here we're going to have the Hugo.
All right.
Who user group or here and so on.
You will have different groups here.
So.
The first group of characters defines to whom the new permission to apply.
In this case, you is.
Yeah, in this case, actually.
Actually.
Sorry for this.
So let's copy this so you can see better here.
So in this case the you.
For user, the G for group and O for others or everyone else.
And R for all of this group is here.
So this will assign to R So the next symbol is used to indicate whether you want to add the permission
to the existing permission with plus subtract the permission from the existing permission from minus
or set the permission to the value.
Finally, the third symbol is the permission used for setting.
So you may notice that there are more than the normal r w x values here.
So the additional settings are here.
So actually let me write that down here.
So here the S is for set.
S is for set s uid or SG ID on execution.
And here we are.
T is for setting sticky bit set sticky bit which I will explain all of this here u is to set set permissions
to the owners owners permission.
The G here.
The G is to set the permissions.
Set.
Permissions.
Oops.
Permissions to the groups.
Groups, Permission.
And.
Your.
And lastly, all here is used for to set permissions to others permission.
So.
Here.
The use for permissions would like this so see mode.
Or.
Plus are my ultra new file.
And let's actually try it again.
And here, as you can see here, we got different results from here.
So.
It's actually.
See what happens.
And this is the actually here, the test one, test two.
And this is test three here.
So.
RW Actually, it's not permission.
Yeah.
One, two, three, and that's it.
So here, as you remember, RW X is 111110 and 100110 and 100.
And here we will have for this 111100.
So seven.
And actually it's the first is seven and then it comes to six.
And lastly.
100 is four and not here for sorry for this.
This is, uh, six.
Four for and seven six and lastly for seven.
Six for.
So the here as you remember here, the O plus R entry also read permission to whatever permission that
everyone security level already had.
So the U minus X and removes the execute permissions that the user already had.
So in order to do that let's actually do this.
C'mon.
C h mode u minus x, And here after that we will use the my ultra new file and a my my ultra new file.
And as you can see here, we just change that.
Let's try that now.
So this one was our my.
My ultra new my ultra file.
They are they made it wrong here.
Test three actually my ultra new file.
New file.
And lastly, new file.
And here we will have this.
Let's load it first.
And here.
One, two, three.
And actually, the second parameters are same, but the first we changed with took the execute permissions
from it.
Let's actually try it now.
Our W was 110.
And again our W was 110.
And lastly our was 1100, which is.
Six, six, four.
And this was our my actually.
Let's test it again.
110.
Six.
Six?
Six.
Six four.
Yeah, that's true.
Ultra new file.
And this is test four.
And that's it with our lecture.
I hope and I will also share these files with you.
So I'm waiting you in next lecture.