User Tools

Site Tools


howto:umask

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
howto:umask [2019/03/07 17:11]
wikiadmin created
howto:umask [2022/03/18 12:12] (current)
wikiadmin
Line 1: Line 1:
 ======umask====== ======umask======
  
-The CHPC cluster uses CentOS as its operating system and follows the user private group scheme for user accounts. This means that each user has a username (UID) and a corresponding group (GID).  This scheme allows for easier set up of shared directories on the various file systems (home or Lustre) that users have access to.+The CHPC cluster uses [[quick:os|CentOS]] as its operating system and follows the user private group convention for user accounts. This means that each user has a username (UID) and a corresponding group (GID).  This scheme allows for easier set up of shared directories on the various file systems (home or Lustre) that users have access to. 
 + 
 +=====Default umask===== 
 + 
 +The default umask is set by the ''umask'' command in your ''.bashrc'' or the system wide ''/etc/bashrc'' file.  For RedHat derived systems (CentOS) the default umask is ''002'' which means the the group permissions of your files and directories will match the user permissions and include write access, the ''w'' flag. 
 + 
 +This is needed for shared groups (not your private user group) where all members of the group need write access. 
 + 
 +=====Checking your current umask===== 
 + 
 +Simply run the command ''umask'' without any arguments on the shell: 
 + 
 +  umask 
 + 
 +and your current umask setting will be displayed: 
 + 
 +  002 
 + 
 +To change it, run the umask command with the desired umask as the sole argument: 
 + 
 +  umask 022 
 + 
 +And you can confirm this by running ''umask'' on its own again. 
 + 
 +=====CHPC Standard===== 
 + 
 +The CHPC departs from the user private convention in one important way.  The convention would normally only specify that the user is a member of the user's private group.  The CHPC adds the user name of the CHPC staff member responsible for supporting your programme. 
 + 
 +So, instead of 
 + 
 +  auser:*:555: 
 + 
 +where there is no user in the group, we have 
 + 
 +  auser:*:555:chpcstaff 
 + 
 +where ''chpcstaff'' would be the username of the CHPC staff member. 
 + 
 +This is to allow our staff to have access to your files to help you with technical issues. 
 + 
 +=====Disabling write access===== 
 + 
 +If you want to remove the ''w'' access from the group permission you will need to change your umask and also change all the current permission bits. 
 + 
 +====Step 1: umask==== 
 + 
 +Edit your ''.bashrc'' file in you home directory and add the line 
 + 
 +  umask 0022 
 + 
 +at the end of the file.  Save it.  Now when you log in next time your umask will block ''w'' from group access. 
 + 
 + 
 +====Step 2: remove w access from all files and directories==== 
 + 
 +Warning: this can take a long time if you have a lot of files so first launch an interactive session before running these commands. 
 + 
 +  qsub -I 
 +   
 +Use the ''find'' command: 
 + 
 +  find . -exec chmod g-w \{\} \; 
  
  
Line 9: Line 71:
   * [[https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/4/html/Reference_Guide/s1-users-groups-private-groups.html|RedHat Documentation: 6.4. User Private Groups]]   * [[https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/4/html/Reference_Guide/s1-users-groups-private-groups.html|RedHat Documentation: 6.4. User Private Groups]]
   * [[https://security.ias.edu/how-and-why-user-private-groups-unix|IAS Network Security:The How and Why of User Private Groups in Unix]]   * [[https://security.ias.edu/how-and-why-user-private-groups-unix|IAS Network Security:The How and Why of User Private Groups in Unix]]
 +
 +
 +======Shared Group Directory======
 +
 +The above is used to share a directory on the cluster amongst the members of a CHPC research programme, also known as a project.
 +
 +The PI of a project can request a Linux group be created on the cluster for their programme, using the short name, also known as the project name.  This is the same project identifier used with job scripts to in
 +
 +The PI of a project can further apply for a shared group directory on ''/mnt/lustre/groups'', however, this requires special motivation as described in the [[chpc:accounts|CHPC User Policy]] document.  The setgid bit will then be set on that directory.
 +
 +
/app/dokuwiki/data/attic/howto/umask.1551971509.txt.gz · Last modified: 2021/12/09 16:42 (external edit)