From owner-freebsd-questions@FreeBSD.ORG Wed Mar 25 21:19:01 2015 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id EB360760 for ; Wed, 25 Mar 2015 21:19:01 +0000 (UTC) Received: from mail-la0-x229.google.com (mail-la0-x229.google.com [IPv6:2a00:1450:4010:c03::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6BC4832F for ; Wed, 25 Mar 2015 21:19:01 +0000 (UTC) Received: by labto5 with SMTP id to5so30702282lab.0 for ; Wed, 25 Mar 2015 14:18:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=references:from:mime-version:in-reply-to:date:message-id:subject:to :cc:content-type; bh=LrHCO5nROKWF0u5qoyVsIETBNmQg0RIXS7dV+iHArNc=; b=FdoIaMTK53nubepfvcNrbhvTqe7kq9IutYuc8IhaJqk/w3/KKhiEGoAXD//qtjM9/S NZW3hjdt20Asb0CNImTY4vKsStdiT2gMusjOVVRjNTRlkxRmEOwm3PK26dciJJGgy+hv PGziyiNdtMqj8Uj8VwJA3pbFM26/VQE7AlmouKu80IBePcxb/FVKnvPsMi2ORNwGcTjd nh18HXMwXtdgX+Qrb1rTi5yXRhHV9l9NTH7SZwJuuGbMB2vhRpl98Q12esIsL+FQQgly KLeT1KfYpbK4jkCr15VJcveUQIlCi90Xot09FqMMHd/AUfQQEO61RvFLyaJm8vXMtJ9c NfZg== X-Received: by 10.152.37.164 with SMTP id z4mr10255831laj.5.1427318339438; Wed, 25 Mar 2015 14:18:59 -0700 (PDT) References: <474FEC65-4E15-4972-A411-E91569B4E2A5@gmail.com> From: Matthew Pherigo Mime-Version: 1.0 (1.0) In-Reply-To: Date: Wed, 25 Mar 2015 16:18:58 -0500 Message-ID: <3183757859924107912@unknownmsgid> Subject: Re: 'pw usermod -G' not removing user from group? To: Rick Miller Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1 Cc: FreeBSD Users X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Mar 2015 21:19:02 -0000 Thanks, Rick! It's crazy that they didn't allow it in; seems like a pretty big issue. Hopefully they'll release a patch through FreeBSD-update soon. In the meantime, do you or anyone else know how to work around this? --Matt On Mar 25, 2015, at 1:09 PM, Rick Miller wrote: On Wed, Mar 25, 2015 at 11:49 AM, Matthew Pherigo wrote: > Hi all, > > The manpage for pw(8) says this about the -G flag: > > The user's name is added to the group lists in /etc/group, and removed > from any groups not specified in grouplist. > > However, when using this option on 10.1, pw decides to get creative: > > $ sudo id -a test > > uid=1003(test) gid=1003(test) groups=1003(test),0(wheel),69(network) > > $ sudo pw usermod test -G network > > $ sudo id -a test > > uid=1003(test) gid=1003(test) groups=1003(test),0(wheel),69(network) > > This isn't the end of the creative liberties, though. When checking > /etc/group, we find: > > network:*:69:test,test > > pw(8) has added the 'test' user to the network group *twice*. In fact, > when I was checking the /etc/group file, I found this little gem: > > wheel:*:0:root,ansible,matt,matt,matt,test > > That trio of matts is the result of configuration management systems > tripping over this strange behavior. > > Was this introduced in a recent patch? I can't imagine this has been > around for long. Hopefully it's just a doc error! This PR[1] describes the problem. It includes a patch, which apparently didn't make it into 10.1 by the looks of it probably due to a code freeze in preparation for release. [1] https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=187189 -- Take care Rick Miller