In order for others to be able to access files and directories that you write to project space, it is important that they are written with the correct Unix file permissions, and are assigned the correct Unix group. If you are unfamiliar with Unix file permissions, we suggested you first read more about Unix file permissions.
First, the project directory (/project/projectname) should have the correct file permissions: read and write permissions to the group, and the executable bit should be set to 's'. You can check the current permissions using
If these are not 'drwxrws---' (assuming you want read, write and execute permissions for both the owner and group), you can set the correct permissions on /project/projectname and all folders in it using
With the s-bit set, any files and folders created within /project/<projectname> should automatically inherit the Unix group ('projectname'). In principle, this only has to be done once.
Note: if at some point there are files/folders with incorrect group settings, you can change the group using
Before creating new files or folders in the project directory, always set
This ensures that all new files and folders created in the project directory are created with read/write permissions for both the user and the group (and no permissions to others).
If you copy data from your home directory to the project space, the file permissions from your home directory will be maintained. Since you will generally not have set read/write access to the group for files stored in your home folder, you need to set those immediately after copying. E.g.
will copy the folder 'my_folder' to your project space, and then set read/write permissions to all files (+rw), for both the user (u) and group (g). Additionally, it sets the execute permission for the group only if the execute permission was already set for the user (X). These settings are applied recursively to all folders within my_folder (-R).
Thus, if the original file permissions in $HOME/my_folder were
Then, after the
chmod, the file permissions in /project/<projectname>/my_folder are
A few things to note that may cause incorrect groups to be set:
- If you copy with
cp -p(i.e. only when including the -p flag), you also need to add the
--no-preserve=ownershipoption to make sure the file is written with the correct project group.
- If you use
rsync -a, you also need to add the
--no-g --chmod=Dg+sargument (after the
-a) to make sure the files are written with the correct project group, and that folders get the s-bit set.