Automating removal of legacy entries in /etc/group

I’m removing entries in /etc/group programmatically.

Because I cannot use grep, cat, or cut for this exercise, I wrote my own program that can produce stdout and stdout data to essentially read a file. If you can write your solution in grep, awk, sed, cat, echo, etc. I can use it.

I have root access and can remove groups manually, but since n groups will contain a ‘+’ character, I need a script that checks for this.

After first I assumed I could append any line including ‘+’ with a #, but I’m now feeling confident that this isn’t how you programmatically manage /etc/groups. I haven’t found great documentation yet and was wondering if someone here might have a better idea on how to disable groups deemed ‘legacy’ via the use of ‘+’ character.

My NIS does not update database from /etc/group

I have one small problem with NIS that does not update group. I am no NIS expert but when I have created NIS and added user, with “make” command I would update the NIS database. Now what I understood, NIS is using /etc/password, /etc/group and /etc/shadow as starting point, from which with “make” command it creates its own database within /etc/yp/. In this group you have group.bysid, group.byname, passwd.byname, passwd.bynumber and all other goodies. So I can see that time stamp of that binary file has changed which I can say when NIS updates something or not.

The problem starts when I wanted to create new group with specific GID, so I used standard script groupadd -g

what it does it creates new group, and in same group file it marks +::: for flagging NIS that new records have been created.

when I go to /var/yp/ and execute “make” command I get this:

gmake[1]: Entering directory `/var/yp/<org_name>' Updating group.byname... Updating group.bygid... Updating netid.byname... gmake[1]: Leaving directory `/var/yp/<org_name>' 

By trying to see the update, I see that time stamp is changed, and by selecting cat /var/yp/group.bygid | grep -a I cannot see any group listed with that specific ID.

Furthermore, when I go to client and I try to execute newgrp it gives me message:

newgrp: group ‘xxx’ does not exist. (Which means that NIS haven’t added any new group that I created in /etc/group)

How to bypass this problem, and why NIS does not update database with of new group?