5

Let's say the group name of user1 is xyz.

Is it possible, in the same Linux machine, that the username of some other user (not user1) is xyz?

dr_
  • 29,602

2 Answers2

6

Yes, it is possible but I wouldn't recommend it as it would be confusing.

Actually it is common practice in most UNIXes and Linux distros, when user xyz is created, to automatically create a group named xyz and assign to it user xyz as its (only) member.

dr_
  • 29,602
4

It's actually common practice to create group with the same name as user. For example there is root account and root group. Check /etc/group and /etc/passwd files to see it. Check also this two nixCraft pages to get to know more about those files:

Understanding /etc/passwd File Format
Understanding /etc/group File

User account and user group is not combined with each other anwhere else than in /etc/passwd file. So you can have:

user1:x:0:0:user2:/root:/bin/bash
user2:x:0:0:user1:/root:/bin/bash

but I think it can be a little bit confusing.

mrc02_kr
  • 2,003