Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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

share|improve this question

2 Answers 2

up vote 6 down vote accepted

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

share|improve this answer

The permissions are stored on the filesystem if that filesystem supports them.

There is no direct connection between the available users or groups on a particular machine with the permissions of a file/folder.

If you delete a group or a user the permissions simply remain the same, you have 2 commands that you can use to change user and group permission, they both require sudo:

  • chgrp to change the group for a file/folder
  • chown to change the owner for a file/folder

for example

sudo chgrp myfellas file.txt

or

sudo chown -R jon music/
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.