Solved Why does my username have it's own group?

Solved issue

CaffeineAddict

Well-Known Member
Joined
Jan 21, 2024
Messages
1,384
Reaction score
954
Credits
11,349
I've noticed files and directories which I create are owned by my username and a group which name is equivalent to my username.

I've run groups command and since my username is "user" I also belong to "user" group:
Bash:
user@msi:~/$ groups
user cdrom floppy sudo audio dip video plugdev users netdev libvirt

But why is there "user" group?
Wouldn't it make more sense to just belong to "users" group since I'm standard user?

In my understanding purpose of groups is to group users together for fs permissions, however the "user" group is obviously only me,
so IMO it makes no sense to have single user group because standard users already are part of "users".
 


Wouldn't it make more sense to just belong to "users" group since I'm standard user?
For cases where you want to give a specific user access to another user's files and you don't want all users to be able to access those files, there is probably a technical reason for it too but I haven't looked it up.
 
Last edited:
For cases where you want to give a specific user access to another user's files and you don't want all users to be able to access your files
This sounds more robust than how it works on Windows but if you add other user to your group that user like you said will have access to ALL of your files.
If you want to restrict this then a new group needs to be made and specific files or directories be set to ownership of that group and both users added to it, so in this case it's not particularly useful to have your own group, but then this are no longer your files.

there is probably a technical reason for it too but I haven't looked it up
I can't think of any but would like to know if there is.
 
This sounds more robust than how it works on Windows but if you add other user to your group that user like you said will have access to ALL of your files.
Imagine if you are working for a department in a company and your colleague becomes sick for a long time, your manager could than request to have you given access to the home directory of your colleague so that you can pick on something your colleague was working on. I'm just giving a random case but there are cases where it is useful.

I can't think of any but would like to know if there is.
The technical reason is every user must have a primary group they belong to.
 
Thanks for links, they led me to https://wiki.debian.org/UserPrivateGroups
I get it now, it's certainly better default than on Windows.

The ownership on Windows is a very nice example of overcomplexity
(if that is a word)

It's so hard to understand, that I hope the creator of the system does, because nobody else does.

On Linux/Unix. it's clear simple and effective, since 50 years at least as well
 
Imagine if you are working for a department in a company and your colleague becomes sick for a long time, your manager could than request to have you given access to the home directory of your colleague so that you can pick on something your colleague was working on. I'm just giving a random case but there are cases where it is useful.

So, wait

user1 has a home directory (obviously :) ) with some self-owned files in them.
So, IF the primary group of that " user1 " is also " user1 ", and the user didn't change group ownership (which is pretty typical) ...

... then, user2, a totally different user, after being given " user1 " as a group to his account, can now navigate into the home of user1 and do anything with those files ?

That is, assuming owner and group permissions to the home directory and file within, are set the same (and, are enabled) between onwer and group level.

Correct ?
 
... then, user2, a totally different user, after being given " user1 " as a group to his account, can now navigate into the home of user1 and do anything with those files ?

That is, assuming owner and group permissions to the home directory and file within, are set the same (and, are enabled) between onwer and group level.

Correct ?
That depends on distro, for Debian the default is read-execute permission but not write permission.

user1 can add group write permission only to specific files or directories if required, thus not compromising their whole home directory.
 
Yeah, I can see an issue there.
Still, root can read it all anyway :)

But I guess it depends from ... that variable. Man, my mind doesn't work tonight. How's that variable called that determines what permissions to set for every file you create. Suppose you have it set to : remove all for group and other. < must take asperin now >
 
But I guess it depends from ... that variable. Man, my mind doesn't work tonight. How's that variable called that determines what permissions to set for every file you create.
You probably mean the special bit? s or S

When group permissions for directory are rws instead of rwx then any file or directory created in that directory has group ownership set to that of parent directory group ownership.

Capital S is same thing except that execute bit is not set, but this is useless on directories because a directory with w write permission but without x execute, have their w write permission ignored.
Capital S is thus useful only for files.

edit:

Or perhaps you refer to umask command?
 
Last edited:
That's cool as well but I mean that one variable that determines what permissions a newly created file gets.

Man, this is the first time in my life I can't recall the name of that. Not good. Can't google it as it's hard to describe.


edit : aaaargh .... Umask !
 
That's cool as well but I mean that one variable that determines what permissions a newly created file gets.
Sorry I edited my previous post, you must be referring to umask command which sets default permission for new files or directories.
 

Members online


Latest posts

Top