0

I recently wiped out /etc/group by being dumb.

I have taken care of obvious missing groups, such sudoers and audio, but is there any way for me to determine if there are more groups missing?

  • 2
    You first could reinstall the filesystem package with packman -S filesystem which installs the /etc/group file. After that you could try to reinstall each package, which should create needed groups. Unfortunately the GIDs are not deterministic and those could change and would mismatch with the associated GIDs in the filesystem. So very likely that you have to fix some things afterwards, but you should get all needed group names. – Thomas Dec 16 '17 at 15:42
  • After that, run sudo find / -nogroup -ls to see which files are still in groups that aren't in /etc/group. – Mark Plotnick Dec 16 '17 at 16:05
  • On my Arch, there is a file calle /etc/group- that has the same content as the /etc/group file. If it's still present, that could help you. You could also try a getent group as it's supposed to have a database with your groups. – Pierre-Alain TORET Dec 16 '17 at 18:20
0

Check to see if /etc/group- (with a tailing dash) exists. That's a backup of the groups file.

I'm more familiar with Debian and Red Hat than Arch, but in general, groups are configured:

  • In the base system installation.
  • As packages are added to the system requiring specific segregation.
  • As new users are added to the system.

Under Debian, forcing a reinstall of all package would take care of the first two instances, and looking at /home the remainder.

And primary user GIDs are the fourth /etc/passwd field by passwd(5).

After taking care of the obvious system groups, take a sweep through /home and maybe run a find looking for any GIDs that aren't in your /etc/groups file. That will tend to point to to any unrestored data.

Meantime, you should also be asking yourself:

  1. Why did you delete /etc/group in the first place?
  2. Why don't you have /etc under revision control?
  3. Why don't you have backups?

I'd focus strongly on addressing all three issues.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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