What happens when I delete a group wich is owner of certain folders and files? Who become the owner then?
What happens when I delete a group wich is owner of certain folders and files? Who become the owner then?
Each user has a unique number, called a uid. Each group has a unique number, called a gid. It's the uid and gid that gets stored as owners of files, not the username or groupname.
The mapping between username and uid is in /etc/passwd
, and the mapping between groupname and gid is in /etc/group
(unless you've set up some other form of database for this).
When you use ls -l
to list files, ls
will query /etc/passwd
and /etc/group
to find the corresponding username and groupname for the file ownership.
When you remove a group, you just remove the mapping between groupname and gid in /etc/group
, nothing happens to the files this group owned, they'll still be owned by the same gid, but since that group doesn't exist anymore, ls -l
will print the gid instead of a groupname, and no one will have access to the file via its group ownership anymore.
If you create a new group and it gets assigned the same gid as the one you deleted, the files will then be owned by that group.
See also http://mywiki.wooledge.org/Permissions