2

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?

1 Answer 1

5

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'.

3
  • 1
    I think this is the correct answer, but I have a minor correction: on OS X, /etc/group doesn't necessarily have correct info; the actual data is in /var/db/dslocal/nodes/Default/groups (which only root has permissions to read directly). Instead, use something like dscl /Search -read /Groups/_lpoperator or dseditgroup -o read _lpoperator. In either case, they'll tell you its GID is 100 (but they'll call it the "PrimaryGroupID"). Jan 6, 2015 at 5:51
  • OH yeah, good point. A lot of OSX config is not in the traditional unix files. Jan 6, 2015 at 17:43
  • Thank you for the explanation. It is the exact answer to my question.
    – Justin He
    Apr 12, 2015 at 10:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .