If you move or copy a file or directory from one project directory to another, or from somewhere within your home directory to somewhere within a project directory, generally the file, or the directory together with its contents, as the case may be, will keep its original ownership and permissions.
So, supposing Joe Bloggs moves a file from his home directory to the project directory
/nesi/project/nesi99999, his fellow team members won't be able to write to it:
$ ls -l README -rw-r--r-- 1 bloggsj bloggsj 235 Mar 14 2014 README $ mv README /nesi/project/nesi99999/bloggsj/README $ ls -l /nesi/project/nesi99999/bloggsj/README -rw-r--r-- 1 bloggsj bloggsj 235 Mar 14 2014 /nesi/project/nesi99999/bloggsj/README
As you can see, the file stays in the group
bloggsj, that is Joe Bloggs' personal group, even though it is now inside the project directory.
There is, however, a solution involving the
rsync command, a more advanced version of
rsync is typically used to copy files between two or more machines, but can also be used within the same machine.
In both these commands, the
--no-groupoptions must both come after
--group, and will therefore override whichever of
--no-groupcome before it.
To copy a file (or directory and its contents), updating its group and setting its permissions
rsync -a --no-perms --no-group --chmod=ugo=rwX,Dg+s /path/to/source /path/to/destination
To move a file (or directory and its contents), updating its group and setting its permissions
--remove-source-filesoption is safe only if every source file is otherwise left intact during the moving process.
rsync --remove-source-files -a --no-perms --no-group --chmod=ugo=rwX,Dg+s /path/to/source /path/to/destination
If you want to set files to executable in all cases, replace
...ugo=rwx.... The capital
X means, "Preserve whatever executable permissions existed on the source file and aren't masked at the destination." A lower case
x on the other hand means, "Make this entity executable, even if it wasn't so previously, though this may be masked at the destination."