It's very possible to create multiple users and groups those share the same uid/gid.
Seriously this may confuse everyone but sometimes you will really need to do that.
I won't tell my "why"; but I share how the thing would be done.
- For groups, you need to modify 3 files
/etc/group,/etc/group-and/etc/gshadow. What to modify? Well, you create a new line which contains exactly some same contents as the line that includes the source group, and update the line with your new group name. For example, let's say we have an original linegroup:bill.gates:x:1000:bill.gatesthat indicates the groupbill.gatesincludes an user namedbill.gates. Now create new linegroup:bill.fences:x:1000:bill.gates, and after saving the file/etc/group, you will have two groupsbill.fencesandbill.gates, both share the same gid=1000, and both includes the same userbill.gates:) - For users, you follow the same way, but changes land on 3 files
/etc/passwd,/etc/passwd-and/etc/shadow.
Please mind the order of new entries. The very first line wins and some application which works with uid may only print the first username what matches the uid.
Top comments (0)