<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: Add a user to the admin group via command line 2.0</title>
	<atom:link href="http://managingosx.wordpress.com/2006/09/15/add-a-user-to-the-admin-group-via-command-line-20/feed/" rel="self" type="application/rss+xml" />
	<link>http://managingosx.wordpress.com/2006/09/15/add-a-user-to-the-admin-group-via-command-line-20/</link>
	<description>Trials and Tribulations of an OS X Administrator</description>
	<lastBuildDate>Thu, 24 Dec 2009 15:11:20 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: GregN</title>
		<link>http://managingosx.wordpress.com/2006/09/15/add-a-user-to-the-admin-group-via-command-line-20/#comment-2696</link>
		<dc:creator>GregN</dc:creator>
		<pubDate>Sun, 29 Apr 2007 01:23:32 +0000</pubDate>
		<guid isPermaLink="false">http://managingosx.wordpress.com/2006/09/15/add-a-user-to-the-admin-group-via-command-line-20/#comment-2696</guid>
		<description>We don&#039;t use Open Directory - just the RFC2307 &quot;Unix&quot; schema on a third-party LDAP server, which is also used to authenticate Linux clients and for most other authentication needs - so we just have the simple POSIX-style groups, not the OD extended-style groups.

-Greg</description>
		<content:encoded><![CDATA[<p>We don&#8217;t use Open Directory &#8211; just the RFC2307 &#8220;Unix&#8221; schema on a third-party LDAP server, which is also used to authenticate Linux clients and for most other authentication needs &#8211; so we just have the simple POSIX-style groups, not the OD extended-style groups.</p>
<p>-Greg</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JLG</title>
		<link>http://managingosx.wordpress.com/2006/09/15/add-a-user-to-the-admin-group-via-command-line-20/#comment-2521</link>
		<dc:creator>JLG</dc:creator>
		<pubDate>Mon, 23 Apr 2007 06:48:12 +0000</pubDate>
		<guid isPermaLink="false">http://managingosx.wordpress.com/2006/09/15/add-a-user-to-the-admin-group-via-command-line-20/#comment-2521</guid>
		<description>I should also verify drewbono&#039;s statement that removing a user from a group requires the reverse of both steps--remove the username from the group&#039;s GroupMembership attribute, and remove the user&#039;s GeneratedUID from the group&#039;s GroupMembers attribute.

On the managed client issue--the client&#039;s authorization is determined at login time, so if you change the authorization, you&#039;ll probably have to reboot the clients in order for it to take effect.</description>
		<content:encoded><![CDATA[<p>I should also verify drewbono&#8217;s statement that removing a user from a group requires the reverse of both steps&#8211;remove the username from the group&#8217;s GroupMembership attribute, and remove the user&#8217;s GeneratedUID from the group&#8217;s GroupMembers attribute.</p>
<p>On the managed client issue&#8211;the client&#8217;s authorization is determined at login time, so if you change the authorization, you&#8217;ll probably have to reboot the clients in order for it to take effect.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JLG</title>
		<link>http://managingosx.wordpress.com/2006/09/15/add-a-user-to-the-admin-group-via-command-line-20/#comment-2520</link>
		<dc:creator>JLG</dc:creator>
		<pubDate>Mon, 23 Apr 2007 06:44:29 +0000</pubDate>
		<guid isPermaLink="false">http://managingosx.wordpress.com/2006/09/15/add-a-user-to-the-admin-group-via-command-line-20/#comment-2520</guid>
		<description>You&#039;re missing one thing: the &quot;new&quot; Open Directory group format, which uses GeneratedUID instead of (or in addition to) the username. So, in order to add a user to a group, you need to add the username to the GroupMembership attribute, and add the user&#039;s GeneratedUID to the group&#039;s GroupMembers attribute.

dscl /LDAPv3/127.0.0.1 append /Groups/Users GroupMembership fred
dscl /LDAPv3/127.0.0.1 read /Users/fred GeneratedUID
dscl /LDAPv3/127.0.0.1 append /Groups/Users GroupMembers [fred&#039;s GeneratedUID]</description>
		<content:encoded><![CDATA[<p>You&#8217;re missing one thing: the &#8220;new&#8221; Open Directory group format, which uses GeneratedUID instead of (or in addition to) the username. So, in order to add a user to a group, you need to add the username to the GroupMembership attribute, and add the user&#8217;s GeneratedUID to the group&#8217;s GroupMembers attribute.</p>
<p>dscl /LDAPv3/127.0.0.1 append /Groups/Users GroupMembership fred<br />
dscl /LDAPv3/127.0.0.1 read /Users/fred GeneratedUID<br />
dscl /LDAPv3/127.0.0.1 append /Groups/Users GroupMembers [fred's GeneratedUID]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: drewbono</title>
		<link>http://managingosx.wordpress.com/2006/09/15/add-a-user-to-the-admin-group-via-command-line-20/#comment-1631</link>
		<dc:creator>drewbono</dc:creator>
		<pubDate>Fri, 02 Feb 2007 01:19:12 +0000</pubDate>
		<guid isPermaLink="false">http://managingosx.wordpress.com/2006/09/15/add-a-user-to-the-admin-group-via-command-line-20/#comment-1631</guid>
		<description>Unfortunately, using the delete command didn&#039;t work for me in the OD in OS X Server.  It did delete the user from the GroupMembership attribute, but apparently OSX Server doesn&#039;t use that for much because the user still showed the deleted group in its group list and the group still listed the user.

The problem lies within the GroupMembers attribute.  In addition to deleting the user from the GroupMembership attrib, one must also delete it from the GroupMembers attribute.  The user&#039;s GeneratedUID is stored there, so there&#039;s an additional step necessary when scripting.  So, for example, to remove the user greg from the group freakinsmartadmins:

dscl /LDAPv3/127.0.0.1 read /Users/greg GeneratedUID
dscl /LDAPv3/127.0.0.1 delete /Groups/freakinsmartadmins GroupMembers F370CB6D-8E38-4B42-9769-00EB876B755B (that&#039;s all supposed to be on one line and this is the GeneratedUID given from the first command)

I haven&#039;t tested this but in script form it should be something like this:
guid=`dscl /LDAPv3/127.0.0.1 read /Users/greg GeneratedUID &#124; cut -d &#039; &#039; -f2`
dscl /LDAPv3/127.0.0.1 delete /Groups/freakinsmartadmins GroupMembers $guid

I have the additional problem of the directory having to be dirtied somehow before the managed clients see that they&#039;re no longer a part of the group.  Anyone know a command to &quot;dirty&quot; the MCX Prefs on the server?</description>
		<content:encoded><![CDATA[<p>Unfortunately, using the delete command didn&#8217;t work for me in the OD in OS X Server.  It did delete the user from the GroupMembership attribute, but apparently OSX Server doesn&#8217;t use that for much because the user still showed the deleted group in its group list and the group still listed the user.</p>
<p>The problem lies within the GroupMembers attribute.  In addition to deleting the user from the GroupMembership attrib, one must also delete it from the GroupMembers attribute.  The user&#8217;s GeneratedUID is stored there, so there&#8217;s an additional step necessary when scripting.  So, for example, to remove the user greg from the group freakinsmartadmins:</p>
<p>dscl /LDAPv3/127.0.0.1 read /Users/greg GeneratedUID<br />
dscl /LDAPv3/127.0.0.1 delete /Groups/freakinsmartadmins GroupMembers F370CB6D-8E38-4B42-9769-00EB876B755B (that&#8217;s all supposed to be on one line and this is the GeneratedUID given from the first command)</p>
<p>I haven&#8217;t tested this but in script form it should be something like this:<br />
guid=`dscl /LDAPv3/127.0.0.1 read /Users/greg GeneratedUID | cut -d &#8216; &#8216; -f2`<br />
dscl /LDAPv3/127.0.0.1 delete /Groups/freakinsmartadmins GroupMembers $guid</p>
<p>I have the additional problem of the directory having to be dirtied somehow before the managed clients see that they&#8217;re no longer a part of the group.  Anyone know a command to &#8220;dirty&#8221; the MCX Prefs on the server?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Axel</title>
		<link>http://managingosx.wordpress.com/2006/09/15/add-a-user-to-the-admin-group-via-command-line-20/#comment-795</link>
		<dc:creator>Axel</dc:creator>
		<pubDate>Sun, 10 Dec 2006 23:11:35 +0000</pubDate>
		<guid isPermaLink="false">http://managingosx.wordpress.com/2006/09/15/add-a-user-to-the-admin-group-via-command-line-20/#comment-795</guid>
		<description>wait. /me dumb. I take that last comment back...</description>
		<content:encoded><![CDATA[<p>wait. /me dumb. I take that last comment back&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Axel</title>
		<link>http://managingosx.wordpress.com/2006/09/15/add-a-user-to-the-admin-group-via-command-line-20/#comment-794</link>
		<dc:creator>Axel</dc:creator>
		<pubDate>Sun, 10 Dec 2006 23:10:39 +0000</pubDate>
		<guid isPermaLink="false">http://managingosx.wordpress.com/2006/09/15/add-a-user-to-the-admin-group-via-command-line-20/#comment-794</guid>
		<description>&lt;code&gt;dscl .&lt;/code&gt; does not work for me. I have to use &lt;code&gt;dscl localhost&lt;/code&gt; instead.</description>
		<content:encoded><![CDATA[<p><code>dscl .</code> does not work for me. I have to use <code>dscl localhost</code> instead.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David M. O'Rourke</title>
		<link>http://managingosx.wordpress.com/2006/09/15/add-a-user-to-the-admin-group-via-command-line-20/#comment-624</link>
		<dc:creator>David M. O'Rourke</dc:creator>
		<pubDate>Fri, 17 Nov 2006 23:30:19 +0000</pubDate>
		<guid isPermaLink="false">http://managingosx.wordpress.com/2006/09/15/add-a-user-to-the-admin-group-via-command-line-20/#comment-624</guid>
		<description>pleases upgrade to using dseditgroup - it will allow you add users to group records without having to have internal knowledge of the group schema.

man dseditgroup for more informaiton.</description>
		<content:encoded><![CDATA[<p>pleases upgrade to using dseditgroup &#8211; it will allow you add users to group records without having to have internal knowledge of the group schema.</p>
<p>man dseditgroup for more informaiton.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
