If I create any new file/directory/link,

sham@mohet01-ubuntu:~$ ls -l
total 48
drwxr-xr-x 3 sham sham 4096 Apr  5 19:03 Desktop
drwxrwxr-x 2 sham sham 4096 Apr  7 11:19 docs
drwxr-xr-x 3 sham sham 4096 Apr  5 18:28 Documents
drwxr-xr-x 2 sham sham 4096 Apr  5 18:56 Downloads
-rw-r--r-- 1 sham sham 8980 Apr  5 10:43 examples.desktop
drwxr-xr-x 2 sham sham 4096 Apr  5 03:46 Music
drwxr-xr-x 2 sham sham 4096 Apr  5 18:46 Pictures
drwxr-xr-x 2 sham sham 4096 Apr  5 03:46 Public
drwxr-xr-x 2 sham sham 4096 Apr  5 03:46 Templates
drwxr-xr-x 2 sham sham 4096 Apr  5 03:46 Videos

I see the group name as sham. user sham is the owner of these files.


How can a group name be same as owner name? What does it imply for a group name to e same as owner name?


User names and group names exist in two independent namespaces, so same name does not need to imply anything. It is simply group which happens to have this name (numeric group id will be likely different than numeric user id for example).

Nevertheless, lot of Linux distributions create new group together with creating new user's account and this group becomes default group for this user (containing, by default, only this one user id). So same group and user names usually (!) implies that the file belongs to group with only this one user in it. (But there is nothing preventing admin to add more users into this group, or even create group of this name which is not related to user of same name in any way.)

  • Oh the kernel knows the id but not name, so the id for group sham is different from owner sham Apr 7 '17 at 20:25
  • Yes, but even IDs are from independent sets, so neither the fact numeric IDs equal each other does imply anything. Maybe this note in my answer is rather misleading...?
    – Martin
    Apr 7 '17 at 20:27

It's a relatively new thing in some Linux distributions. The group name is a 'private group' that's created by default for all new users.

In Linux a default group is required. Users were previously added to the default primary group users with the system id 100. In some situations this was problematic as it gave 'group access' to other user files and this isn't always desirable. Think of grandma sharing your private documents and photographs etc. The new 'user user' group is to prevent that happening by default.

Now days by default in many distros each user will have their own private group duplicating their username. They can choose who, if anyone, they would like to add to it.

When you create new files your default group automatically gets group ownership of the new file/s. In most cases you will want that to be your private group, so it is default.

You can be member of many different secondary groups also. To switch between secondary groups, so that newly created files will have their group ownership, the command (very unintuitively) is newgrp. Like this:

$ newgrp myOtherGroup

All new files you create will have the 'group ownership' of myOtherGroup until you newgrp username or reboot.

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.