1833862 Members
2405 Online
110063 Solutions
New Discussion

group ownership

 
subhashni
Regular Advisor

group ownership

Hi,
What happens if i delete a group entry(by mistake) in /etc/group .But still there is user account with that gid ,and files with that group ownership.Please help.
Thanks
unix4me
7 REPLIES 7
John Poff
Honored Contributor

Re: group ownership

Hi,

It probably isn't a complete disaster. The programs that resolve the groupname will just report the GID instead of the group name. If you do an 'ls -l' on some files that belong to the group you accidentally deleted, you'll probably see that. You should be able to just edit /etc/group or go into SAM and add the entry for the group again.

JP
A. Clay Stephenson
Acclaimed Contributor

Re: group ownership

Actually not a lot. What will be gone is the gid to name mapping so that what was 'mygroup' will now simply display 47 (assuming that 47 was the deleted group entry). Simply recreate the group entry reusing the same gid and all will be well.

If it ain't broke, I can fix that.
Kevin Wright
Honored Contributor

Re: group ownership

No big deal. Just add the group back into /etc/group with the same gid and things will be back to normal.
subhashni
Regular Advisor

Re: group ownership

John,
What you told, was happend.I saw the corresponding gid when i did ls -l on those files.There was no entry in /etc/group,how the files getting gid ,i wonder.
Thanks
unix4me
Kevin Wright
Honored Contributor

Re: group ownership

gid is stored in inodes. the inode still exists for the file
subhashni
Regular Advisor

Re: group ownership

Great.!!Thank you all.
unix4me
John Poff
Honored Contributor

Re: group ownership

Unix uses the UID and GID and stores it with each file [in the inode]. When you do an 'ls -l' the 'ls' program does a lookup against /etc/passwd and /etc/group to match up the UID and GID to a user/group name. If there isn't a match, it just shows the ID number.

It is sort of like doing a lookup for a hostname in your /etc/hosts file against an IP address. If you find a match you know what hostname belongs to the IP address. If you don't find a match, you just have an IP address.

JP