On Tue, 12 Aug 2014, Ilia Zykov wrote: > Maybe anybody knows how to remove an user from a secondary(additional) > group without > manual edits the /etc/group. For instance: > FreeBSD 'pw groupmod group -d user'
The user(8) tool doesn't offer it, but its code does have rm_user_from_groups function for removing from all groups. Maybe you can reuse or extend that code to have routine to only remove from defined group(s). By the way, the usermod/groupmod tool(s) on Linux (I looked at Ubuntu passwd 1:4.1.4.2+svn3283-3ubuntu5.1 package) also doesn't have this feature, but the usermod -G does remove the user from any groups not listed with the -G.