Linux - Change owner or group of file
Nov 28, 2024
Linux - Change owner or group of file
View Video Transcript
0:00
now here in this video we are going to
0:02
see how we can change a owner or a group
0:04
of a father now for an example I'm
0:07
working on a particular project and I
0:09
have done with my task now I want to
0:12
hand over this project to someone else
0:13
so as being an owner of that particular
0:16
directory or a file of my project I am
0:19
the owner I have the full access now I
0:21
have to change the owner so that the
0:23
other person to whoever handed over the
0:26
project should get the full access so
0:28
for that I need to change the owner so
0:30
how we are going to do that we are going
0:32
to see here along with that I can also
0:35
take an example now I am working on a
0:36
project but my group members are changed
0:39
so previously I had 15 members integral
0:42
so I have already added those members
0:44
into microbe now if I want to add some
0:46
other members in spite of modifying
0:49
their existing group members I can also
0:51
change the group for a temporary reason
0:53
so that also I can do by using the group
0:56
change so how we are going to change the
0:58
owner and group that we are going to see
1:00
here I can use the command called as CH
1:03
own called as change owner I can use for
1:07
changing the owner of a file or a
1:08
directory the command I can use in such
1:11
a way CH own and the new owner name for
1:15
the file or directory which we are going
1:17
to add here same way we can also change
1:19
the group by giving command C and GRP
1:22
this chgrp we can use for existing group
1:25
we can change with the new group or a
1:28
file or directory the command which we
1:30
can use as chgrp the new group name and
1:34
then file or a directory this group can
1:37
be owner group or it can be a
1:39
supplementary group we can change our
1:41
owners drop by any way either for the
1:44
supplementary or D Krupnick
1:46
and one more thing this commands can
1:48
only be used or performed by the root
1:52
user or the user who is having the
1:55
rights by given by the root user so our
1:58
standard user cannot change the group or
2:00
standard users cannot change the owner
2:02
for that you need to contact your
2:03
administrator so let us check in the
2:06
terminal how we can use the chgrp and CH
2:09
own commands for changing the
2:10
group of the user or directory now into
2:14
previous video we have seen how we can
2:15
add a user into Accra now here are into
2:19
previous video also have created a
2:20
directory with name root share and I was
2:26
the owner that if the root was the owner
2:27
for this particular directory while
2:31
others were the member of it now I
2:33
already have done with this particular
2:34
directory now I want to change the owner
2:37
of this particular directory so that he
2:39
should have the full control I want to
2:42
make the trainer of full control
2:44
permission for this directory and I want
2:46
to hand over this particular directory
2:47
completely to my trainer what I can do
2:49
is I can change the owner and this color
2:51
can be changed only by the root even
2:53
though the directory is created by any
2:55
other user as well so change owner what
2:58
a new one are you I want for this
2:59
directory that is trainer for which
3:02
directory that is your root share can
3:07
check once you have given the command
3:09
and press and let's long the file you
3:15
can see now the true owner of this rec
3:17
race trainer so ultimately what will
3:19
happen the owner will get the full
3:21
control so let us check whether we have
3:23
the full control or not so this is
3:29
trainer has locked him now
3:31
trainer wants to move into the root
3:34
share he is able to health able to
3:38
listed directories he is able to create
3:42
directories as well right because we are
3:45
now this particular directory has the
3:48
permission and he we have changed the
3:51
owner of this directory same way I can
3:53
also change the crop of the directory
3:55
now we have already created a directory
3:59
using the root so root had the
4:02
permission only for trainers and users I
4:05
want to change the crop as well I want
4:07
that as the owner is the root so the
4:10
root should have sorry though as their
4:12
owner is the trainer now so the trainer
4:14
should manage the crook so I'll be
4:16
adding the trainers grouped over here
4:18
and I will remove my group so for that
4:20
I'll give CH GRP
4:24
the new name of the crop that is
4:26
strainer even we can add a supplementary
4:28
group but for supplementary group again
4:30
you need to add the users who can get
4:33
access to this particular group ok so
4:36
who are the members of this group you
4:38
need to add it manually now here I'm
4:40
going to add the share name and check
4:44
here
4:47
the group has been change right so the
4:52
user one is a member of this root share
4:55
now so how will get to know which is my
4:59
group member we can check into the group
5:02
and also we can use I want to just
5:05
search for
5:09
trainer okay the trainer has a group
5:13
member user one so if I'm getting login
5:16
from the user one
5:24
okay and user1 I can move into the
5:30
root share he will be able to list the
5:34
things but if he is trying to write
5:36
anything he won't be because again we
5:39
have the permission for your root share
5:41
as
5:44
you read and execute fraud a group
5:46
members if this user is not a group
5:49
member it will directly get the access
5:51
denied formation so this is how
5:53
generally we manage the owners group and
5:56
the no no we can change the crowbar or
6:00
change the owner of a particular
6:01
directory or a file by using this eh
6:04
more and chgrp command using the root so
6:08
into the next video I'm going to show
6:09
you more permissions which we can assign
6:11
for an individual user inspite of
6:14
locking the groups and a permission what
6:17
we have allocated to that particular
6:19
firm so let us check in to the next to
6:21
it here
#Operating Systems
#Programming
#Software