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.

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

ls -lad /project/<projectname>


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

chmod -R u+rwx,g+rwxs /project/<projectname>


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

chgrp [group] [dir/file]


Before creating new files or folders in the project directory, always set

umask 007


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.


cp -r $HOME/my_folder /project/<projectname>
chmod -R ug+rwX /project/<projectname>


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

-rwx------ 1 casparl casparl  0 Oct  4 18:09 file1
-rw------- 1 casparl casparl  0 Oct  4 18:09 file2
drwx------ 2 casparl casparl 10 Oct  4 18:09 test


Then, after the cp and chmod, the file permissions in /project/<projectname>/my_folder are

-rwxrwx--- 1 casparl project  0 Oct  4 18:09 file1
-rw-rw---- 1 casparl project  0 Oct  4 18:09 file2
drwxrws--- 2 casparl project 10 Oct  4 18:09 test


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=ownership option 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+s argument (after the -a) to make sure the files are written with the correct project group, and that folders get the s-bit set.
  • No labels