On Mon, Mar 21, 2011 at 05:50:37PM +0000, Steve Clarke wrote: > I have read on the hindernet, that to remove a user from a group, > you simply run usermod -G, and omit the group that you want the > user to be removed from. These posts are often associated with > HPUX and Solaris. > > The same does not work with OpenBSD, and on looking into the code > (user.c), it is clear that the functionality to remove users from a group is > simply not there. > > This issue has been around for 10 years (see the following links): > > http://marc.info/?l=openbsd-misc&m=109088617022480&w=2 > http://marc.info/?l=tru64-unix-managers&m=97203990632722&w=2 > > I am looking for the ability to remove users from groups, and I am quite > capable of modifying user.c to provide compatibility, but there may be a > better way ... > > My questions are: > > 1. Is there a different application which can be used to remove users > from secondary groups? (I'd like to automate, so vi isn't an option)? > > 2. Should the -G switch be used to remove users from groups so the > operation is consistent with that of HPUX and Solaris. > > 3. What is the ettiquette for agreeing an additional functionality, and > submitting patches, once I've made the user.c modifications? > > Thanks and Regards, > > Steve C >
I use a small script with sed to make one line changes in files. It asks for the file location and what to match. making it substitute nothing would remove a line from /etc/group or drop a single user and insert the changed line back. OpenBSD's form of sed requires you to output to a new file and mv that back to original. But that isn't a big deal. I mostly use the script myself to change many html/css files to reflect a site or server wide change. Very fast and easy. And very simple to automate. Chris Bennett