title: Why does this rsync command change the user correctly, but not the group?
body: <p>I have a directory on my local machine called <code>foo</code> that contains a file called <code>document</code>. The user and group for <code>foo</code> and <code>document</code> are <code>A:B</code>.</p>
  
  <p>I want to move these files to a remote directory <code>remote-dir</code> using rsync. <code>remote-dir</code> contains other directories, but not <code>/foo</code>, so rsync will be introducing <code>/foo</code> and <code>/foo/document</code> to the remote directory for the first time. The files inside <code>remote-dir</code> should all have a user:group of <code>J:L</code>. Here's what that looks like:</p>
  
  <p><strong>BEFORE</strong></p>
  
  <pre><code>/foo/         (A:B)        /remote-dir/      (J:K)
   `- document  (A:B)         `- other/        (J:L)
                              `- directories/  (J:L)
  </code></pre>
  
  <p>I used the following rsync command to carry out the transfer*:</p>
  
  <pre><code>rsync -rv --super --owner --chown=J:L ./foo/ root@remote:/remote-dir/foo
  </code></pre>
  
  <p><strong>EXPECTED</strong></p>
  
  <pre><code>/foo/         (A:B)        /remote-dir/      (J:K)
   `- document  (A:B)         `- other/        (J:L)
                              `- directories/  (J:L)
                              `- foo/          (J:L)
                                 `- document   (J:L)
  </code></pre>
  
  <p>I expect <code>/foo</code> and <code>/foo/document</code> to appear in <code>remote-dir</code> with a user:group of <code>J:L</code>.</p>
  
  <p><strong>ACTUAL</strong></p>
  
  <pre><code>/foo/         (A:B)        /remote-dir/      (J:K)
   `- document  (A:B)         `- other/        (J:L)
                              `- directories/  (J:L)
                              `- foo/          (J:root)
                                 `- document   (J:root)
  </code></pre>
  
  <p>In actuality, <code>/foo</code> and <code>/foo/document</code> appear in <code>remote-dir</code> with a user-group of <code>J:root</code>, <code>root</code> being the group of the root user I specified in the rsync command (<code>root@remote:[...]</code>).</p>
  
  <p>According to the man page, <code>--chown=J:L</code> is equivalent to <code>--usermap=*:J --groupmap=*:L</code>, and as we can see, the usermap is working correctly, but the groupmap is not.</p>
  
  <p>Am I doing anything wrong? Any incorrect assumptions? <strong>What should be on my sanity checklist?</strong></p>
  
  <p>*rsync options explained:</p>
  
  <ul>
  <li><code>-r</code> for recursive</li>
  <li><code>--super</code> because the "receiver attempts super-user activities" (chown)</li>
  <li><code>--owner</code> because chown uses <code>--usermap</code> and <code>--groupmap</code> internally, and these options require <code>--owner</code> to function (<strong>edit:</strong> actually, this is incorrect. <code>--usermap</code> requires <code>--owner</code>, but <code>--groupmap</code> requires a separate option <code>--group</code>.) </li>
  </ul>