Saturday, April 20, 2024
 Popular · Latest · Hot · Upcoming
7
rated 0 times [  7] [ 0]  / answers: 1 / hits: 3831  / 2 Years ago, tue, december 14, 2021, 10:12:41

What happens when I delete a group wich is owner of certain folders and files? Who become the owner then?


More From » permissions

 Answers
7

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


[#36903] Tuesday, December 14, 2021, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ronicod

Total Points: 71
Total Questions: 111
Total Answers: 111

Location: Montenegro
Member since Fri, Dec 10, 2021
2 Years ago
;