So in this video, we are going to see these commands for changing the permission of the file. So now the first command is ch mode. That means change the mode of a file. So the modes that we can change to our read, write and execute. So now, let me list the files. So here, as you can see, we are going to change the modes of this are demo dot txt.
So here it is. READ WRITE, read and read. So ch mode, then space, then you have to specify an octal number. So the octal number goes from zero to seven So the zero being no permissions provided and then after one stands for execute, then two stands for write, and four stands for read. So if I write here 111, then the first one represents that it will give the execute permission to the demo dot txt file. The first one represents the permission for user.
The second represents the permission for group and the third is for other. So, I have written 111. So that means it is going to be an executable file. If I write here, two to two then that means It will have the right permission. And if I write 444, then it will have the read permission. So let's run this.
So as you can see here, all the three are have read permission. So this is how you can do that. Now you can also combine these numbers. So if I want to do read and write permission, then that means four plus two, so that is six. So if I write this, then the readwrite permission will be provided. And if I want to also give the execute permission, so that means I'm going to specify 777.
So as you can see, our w r x so read, write and execute all permissions are provided. And if I make one as zero, then no permission will be provided there. So as you can see, only two of them are there. So first is for the user then is for the group, and the next for others is not present. So this is how you can give permission to the file. So, this is how you can change permissions of file.
So, now the next command is CH, or the blue and now, this command is used to change the ownership of the file. So, now I'm going to change the ownership of the demo dot txt. So, Let's first see by going into properties. So the owner here is me, that is our cash. So I'm logged in as aka. So I'm the owner of this file, and the group is also our cash.
So now I'm going to change the owner to root. So I'm going to write CH, O w and space, the user, so that is root, then space, the name of the file, that is demo dot txt. So we will need superuser privileges to do so. So I'm going to write sudo then demo dot txt and let's see if it's change. So as you can see here, the owner of this file is changed. Now I'm going to change the coop of this file as well.
Right now the group is archived, I'm going to change the group to group. So to do that, you just have to right column here, and right, the group name, so that is rude. So first one is the user and then his group. And let's see. As you can see here, the group of this file also is changed to root. So this is how you can give or change the permissions of the file and change the ownership of the file as well.