Rsync on OS X changes folder’s group name to _lpoperator

mac-osxrsync

Here is how to demo the problem:

  1. Grab Terminal on OSX, and run

    cd ~ && mkdir abc && ls -l ~/
    

    Here is the output about folder "abc":

    drwxr-xr-x   2 justin  staff    68 Jan  4 20:20 abc
    

    The group name can be seen as "staff".

  2. rsync a file or folder from remote server to the folder "abc":

    rsync -aP -v -z -h username@server:/mnt/foo/ ~/abc/
    
  3. check the group name of the folder "abc" again:

    $ ls -l ~/
    drwxr-xr-x   2 justin  _lpoperator    68B Jan  4 19:44 abc
    

    and all the files in "abc", the group names are _lpoperator. Try to create a file in "abc" and check its group name,

    $ touch def
    $ ls -l ~/abc
    -rw-r--r--  1 justin  _lpoperator  0 Jan  4 20:28 def
    

I know when i use -a option for rsync, it will try to keep the permission for that remote file, but why _lpoperator was created? it's really weird, any idea?

Best Answer

This is happening because you are using the -a option to rsync. One setting that '-a' turns on is '-g', preserve group. The folder or file you are transferring from the remote machine is owned by group id (gid) 100. On your machine, gid 100 is '_lpoperator'. You can verify this by runninggrep _lpoperator /etc/group. That will show the actual group id of 100.

So, when rsync does the transfer, it preserves the gid from the remote file. That gid maps to the _lpoperator group on your machine, so you see that the group changes when you run 'ls'.