What âchgrp 0â do?
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I am analyzing one script and I cannot find online what chgrp 0
mean in the following line:
find $1 -follow -exec chgrp 0
so
find $1
takes parameter,
-follow
causes find to follow symlinks,
-exec
executes the command,
chgrp 0
change group ownership, but what 0 do?,
for all items found by the find command.
Please correct me if I am wrong with something.
find chgrp
add a comment |Â
up vote
0
down vote
favorite
I am analyzing one script and I cannot find online what chgrp 0
mean in the following line:
find $1 -follow -exec chgrp 0
so
find $1
takes parameter,
-follow
causes find to follow symlinks,
-exec
executes the command,
chgrp 0
change group ownership, but what 0 do?,
for all items found by the find command.
Please correct me if I am wrong with something.
find chgrp
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I am analyzing one script and I cannot find online what chgrp 0
mean in the following line:
find $1 -follow -exec chgrp 0
so
find $1
takes parameter,
-follow
causes find to follow symlinks,
-exec
executes the command,
chgrp 0
change group ownership, but what 0 do?,
for all items found by the find command.
Please correct me if I am wrong with something.
find chgrp
I am analyzing one script and I cannot find online what chgrp 0
mean in the following line:
find $1 -follow -exec chgrp 0
so
find $1
takes parameter,
-follow
causes find to follow symlinks,
-exec
executes the command,
chgrp 0
change group ownership, but what 0 do?,
for all items found by the find command.
Please correct me if I am wrong with something.
find chgrp
find chgrp
edited Aug 21 at 15:06
Jeff Schaller
32.7k849110
32.7k849110
asked Aug 21 at 15:05
spaceman117X
368
368
add a comment |Â
add a comment |Â
3 Answers
3
active
oldest
votes
up vote
5
down vote
accepted
chgrp 0 file
will change the group ownership of the file file
to the group with GID 0
which in nearly all cases in Linux is the root
group (in BSD, this is nearly always wheel
). So your find
command will search in the path provided by the first positional parameter ($1
) for all filesystem objects contained therein, follow any symbolic links to their targets, and make the group owner of those objects GID 0
, root
(or wheel
).
1
yes, that makes sense, thanks @DopeGhoti
â spaceman117X
Aug 21 at 15:12
Pleased to have helped. Welcome to U&L! If this answered your question, please click the checkmark to the left of this answer to indicate that your question has been answered to your satisfaction.
â DopeGhoti
Aug 21 at 15:14
1
On BSD systems, the group with GID zero will likely be thewheel
group (which is the primary group of theroot
user).
â Kusalananda
Aug 21 at 15:43
add a comment |Â
up vote
1
down vote
Basicly ownership of any file/directory in linux is stored in the in inode. And it stored as an integers (integer for user, and second integer for group). It depends only on your NSS (e.g. /etc/passwd file, or ldap) which name it will show you in ls. Performing operation like chgrp root file
system will take GID of "root" group (in my case it's 0) and write that 0 into inode. You can also make something like this:
# touch testfile
# chgrp 135543 testfile
# ls -l testfile
-rw-r--r--. 1 root 135543 0 Aug 21 18:05 testfile
# groupadd -g 135543 testgroup
# ls -l testfile
-rw-r--r--. 1 root testgroup 0 Aug 21 18:05 testfile
"Something". Fixed.
â Alexander
Aug 21 at 17:42
Yes, In my (beginners) opinion it is more logical to writechgrp root file
than to assume that root group is number zero
â spaceman117X
Aug 22 at 6:21
add a comment |Â
up vote
0
down vote
0 is the UID and GID of root. So as you are executing chgrp 0 you are changing the group ownership of the file/directory to root.
add a comment |Â
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
5
down vote
accepted
chgrp 0 file
will change the group ownership of the file file
to the group with GID 0
which in nearly all cases in Linux is the root
group (in BSD, this is nearly always wheel
). So your find
command will search in the path provided by the first positional parameter ($1
) for all filesystem objects contained therein, follow any symbolic links to their targets, and make the group owner of those objects GID 0
, root
(or wheel
).
1
yes, that makes sense, thanks @DopeGhoti
â spaceman117X
Aug 21 at 15:12
Pleased to have helped. Welcome to U&L! If this answered your question, please click the checkmark to the left of this answer to indicate that your question has been answered to your satisfaction.
â DopeGhoti
Aug 21 at 15:14
1
On BSD systems, the group with GID zero will likely be thewheel
group (which is the primary group of theroot
user).
â Kusalananda
Aug 21 at 15:43
add a comment |Â
up vote
5
down vote
accepted
chgrp 0 file
will change the group ownership of the file file
to the group with GID 0
which in nearly all cases in Linux is the root
group (in BSD, this is nearly always wheel
). So your find
command will search in the path provided by the first positional parameter ($1
) for all filesystem objects contained therein, follow any symbolic links to their targets, and make the group owner of those objects GID 0
, root
(or wheel
).
1
yes, that makes sense, thanks @DopeGhoti
â spaceman117X
Aug 21 at 15:12
Pleased to have helped. Welcome to U&L! If this answered your question, please click the checkmark to the left of this answer to indicate that your question has been answered to your satisfaction.
â DopeGhoti
Aug 21 at 15:14
1
On BSD systems, the group with GID zero will likely be thewheel
group (which is the primary group of theroot
user).
â Kusalananda
Aug 21 at 15:43
add a comment |Â
up vote
5
down vote
accepted
up vote
5
down vote
accepted
chgrp 0 file
will change the group ownership of the file file
to the group with GID 0
which in nearly all cases in Linux is the root
group (in BSD, this is nearly always wheel
). So your find
command will search in the path provided by the first positional parameter ($1
) for all filesystem objects contained therein, follow any symbolic links to their targets, and make the group owner of those objects GID 0
, root
(or wheel
).
chgrp 0 file
will change the group ownership of the file file
to the group with GID 0
which in nearly all cases in Linux is the root
group (in BSD, this is nearly always wheel
). So your find
command will search in the path provided by the first positional parameter ($1
) for all filesystem objects contained therein, follow any symbolic links to their targets, and make the group owner of those objects GID 0
, root
(or wheel
).
edited Aug 21 at 15:56
answered Aug 21 at 15:09
DopeGhoti
41.1k55080
41.1k55080
1
yes, that makes sense, thanks @DopeGhoti
â spaceman117X
Aug 21 at 15:12
Pleased to have helped. Welcome to U&L! If this answered your question, please click the checkmark to the left of this answer to indicate that your question has been answered to your satisfaction.
â DopeGhoti
Aug 21 at 15:14
1
On BSD systems, the group with GID zero will likely be thewheel
group (which is the primary group of theroot
user).
â Kusalananda
Aug 21 at 15:43
add a comment |Â
1
yes, that makes sense, thanks @DopeGhoti
â spaceman117X
Aug 21 at 15:12
Pleased to have helped. Welcome to U&L! If this answered your question, please click the checkmark to the left of this answer to indicate that your question has been answered to your satisfaction.
â DopeGhoti
Aug 21 at 15:14
1
On BSD systems, the group with GID zero will likely be thewheel
group (which is the primary group of theroot
user).
â Kusalananda
Aug 21 at 15:43
1
1
yes, that makes sense, thanks @DopeGhoti
â spaceman117X
Aug 21 at 15:12
yes, that makes sense, thanks @DopeGhoti
â spaceman117X
Aug 21 at 15:12
Pleased to have helped. Welcome to U&L! If this answered your question, please click the checkmark to the left of this answer to indicate that your question has been answered to your satisfaction.
â DopeGhoti
Aug 21 at 15:14
Pleased to have helped. Welcome to U&L! If this answered your question, please click the checkmark to the left of this answer to indicate that your question has been answered to your satisfaction.
â DopeGhoti
Aug 21 at 15:14
1
1
On BSD systems, the group with GID zero will likely be the
wheel
group (which is the primary group of the root
user).â Kusalananda
Aug 21 at 15:43
On BSD systems, the group with GID zero will likely be the
wheel
group (which is the primary group of the root
user).â Kusalananda
Aug 21 at 15:43
add a comment |Â
up vote
1
down vote
Basicly ownership of any file/directory in linux is stored in the in inode. And it stored as an integers (integer for user, and second integer for group). It depends only on your NSS (e.g. /etc/passwd file, or ldap) which name it will show you in ls. Performing operation like chgrp root file
system will take GID of "root" group (in my case it's 0) and write that 0 into inode. You can also make something like this:
# touch testfile
# chgrp 135543 testfile
# ls -l testfile
-rw-r--r--. 1 root 135543 0 Aug 21 18:05 testfile
# groupadd -g 135543 testgroup
# ls -l testfile
-rw-r--r--. 1 root testgroup 0 Aug 21 18:05 testfile
"Something". Fixed.
â Alexander
Aug 21 at 17:42
Yes, In my (beginners) opinion it is more logical to writechgrp root file
than to assume that root group is number zero
â spaceman117X
Aug 22 at 6:21
add a comment |Â
up vote
1
down vote
Basicly ownership of any file/directory in linux is stored in the in inode. And it stored as an integers (integer for user, and second integer for group). It depends only on your NSS (e.g. /etc/passwd file, or ldap) which name it will show you in ls. Performing operation like chgrp root file
system will take GID of "root" group (in my case it's 0) and write that 0 into inode. You can also make something like this:
# touch testfile
# chgrp 135543 testfile
# ls -l testfile
-rw-r--r--. 1 root 135543 0 Aug 21 18:05 testfile
# groupadd -g 135543 testgroup
# ls -l testfile
-rw-r--r--. 1 root testgroup 0 Aug 21 18:05 testfile
"Something". Fixed.
â Alexander
Aug 21 at 17:42
Yes, In my (beginners) opinion it is more logical to writechgrp root file
than to assume that root group is number zero
â spaceman117X
Aug 22 at 6:21
add a comment |Â
up vote
1
down vote
up vote
1
down vote
Basicly ownership of any file/directory in linux is stored in the in inode. And it stored as an integers (integer for user, and second integer for group). It depends only on your NSS (e.g. /etc/passwd file, or ldap) which name it will show you in ls. Performing operation like chgrp root file
system will take GID of "root" group (in my case it's 0) and write that 0 into inode. You can also make something like this:
# touch testfile
# chgrp 135543 testfile
# ls -l testfile
-rw-r--r--. 1 root 135543 0 Aug 21 18:05 testfile
# groupadd -g 135543 testgroup
# ls -l testfile
-rw-r--r--. 1 root testgroup 0 Aug 21 18:05 testfile
Basicly ownership of any file/directory in linux is stored in the in inode. And it stored as an integers (integer for user, and second integer for group). It depends only on your NSS (e.g. /etc/passwd file, or ldap) which name it will show you in ls. Performing operation like chgrp root file
system will take GID of "root" group (in my case it's 0) and write that 0 into inode. You can also make something like this:
# touch testfile
# chgrp 135543 testfile
# ls -l testfile
-rw-r--r--. 1 root 135543 0 Aug 21 18:05 testfile
# groupadd -g 135543 testgroup
# ls -l testfile
-rw-r--r--. 1 root testgroup 0 Aug 21 18:05 testfile
edited Aug 21 at 17:42
answered Aug 21 at 16:09
Alexander
78913
78913
"Something". Fixed.
â Alexander
Aug 21 at 17:42
Yes, In my (beginners) opinion it is more logical to writechgrp root file
than to assume that root group is number zero
â spaceman117X
Aug 22 at 6:21
add a comment |Â
"Something". Fixed.
â Alexander
Aug 21 at 17:42
Yes, In my (beginners) opinion it is more logical to writechgrp root file
than to assume that root group is number zero
â spaceman117X
Aug 22 at 6:21
"Something". Fixed.
â Alexander
Aug 21 at 17:42
"Something". Fixed.
â Alexander
Aug 21 at 17:42
Yes, In my (beginners) opinion it is more logical to write
chgrp root file
than to assume that root group is number zeroâ spaceman117X
Aug 22 at 6:21
Yes, In my (beginners) opinion it is more logical to write
chgrp root file
than to assume that root group is number zeroâ spaceman117X
Aug 22 at 6:21
add a comment |Â
up vote
0
down vote
0 is the UID and GID of root. So as you are executing chgrp 0 you are changing the group ownership of the file/directory to root.
add a comment |Â
up vote
0
down vote
0 is the UID and GID of root. So as you are executing chgrp 0 you are changing the group ownership of the file/directory to root.
add a comment |Â
up vote
0
down vote
up vote
0
down vote
0 is the UID and GID of root. So as you are executing chgrp 0 you are changing the group ownership of the file/directory to root.
0 is the UID and GID of root. So as you are executing chgrp 0 you are changing the group ownership of the file/directory to root.
answered Aug 21 at 15:37
Rituraj
9818
9818
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f463890%2fwhat-chgrp-0-do%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password