Hi,
Here is the scenario:
This file exists, with this ownership and group:
-rw-rw-r-- 1 picard starfleet 4 Jan 3 00:33 myfile.txt
Output of the 'id' command for user picard is:
$ id picard
uid=6392(picard) gid=723(human) groups=723(human),918(starfleet)
Output of the 'id' command for user worf is:
$ id worf
uid=7413(worf) gid=737(klingon) groups=737(klingon),918(starfleet)
When worf runs:
$ /bin/cp -p myfile.txt mycopy.txt
the ownership and group look like:
-rw-rw-r-- 1 worf klingon 4 Jan 3 00:33 mycopy.txt
Both picard and worf belong to starfleet. Even though worf's effective gid isn't "starfleet", worf was expecting to see "starfleet" as the group owner of the mycopy.txt file.
How can worf get the desired results? Is there some other command that should be used instead of 'cp' command to achieve the desired results?
Yes, using "chgrp" to change the group owner works, but is there some single copy-like command (ie: "tar" or "rsync", etc...) that can be used?
Thanks
--Andrew