0

I am creating local groups in different linux systems with same name but they have different GID in different system.I have a share drive between these three system and if am creating a folder and assigning the group permission on the folder the instance on which the folder is showing Group name but in another two instances its just showing the GID of the group on which instance the folder is created i am confusing here please see the example below

Group_Name  GID    IP-Address
mygroup     571    Host A
mygroup     822    Host B
mygroup     1023   Host C

If i am creating a folder on share drive between these systems on Host A if i got to share drive in Host B or C i see the folder group name as 571.

As per linux documentation is see that GID is assigned in a range specified and now i am manually going to each linux instance and changing the GID on each server to make sure everything has same ID using below command

groupmod -g 3000 mygroup

I am newbie to linux this is not a best practice i have two queries

1) Is it ok to have two groups with GID in linux system? 2) Is there any automated way to make sure all three Groups get same GID?

Please help me in solving this issue

3

You can use groupadd's -g option to specify the ID you want the new group to have.
If modifying group IDs with groupmod be aware you'll have to adjust the ownership of files that are using the old ID.

Is it ok to have two groups with GID in linux system

It's possible (using the -o option in groupadd and groupmod) but the default behavior is to prevent this. User names and group names simply map a name onto a IDs so having duplicate IDs can result in unexpected results. E.g. you wouldn't expect chowning a directory to a group with one name to also give access to a group with a different name.

The proper solution is a centralized user/group management system

Systems like LDAP (Lightweight Directory Access Protocol) exist to solve the exact issue you're describing - managing permissions in a consistent manner across several systems.
You'll be able to create users/groups in one place and all systems connected to the LDAP server will use the same IDs for each user/group name.

1
  • I agree with you using LDAP groups but we have a temporary requirements that's why i am going with local groups instead of LDAP groups.
    – Rahul
    Sep 9 '19 at 6:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.