| Change your current group ID |
|
By default your primary group on the HPC is the same name as your user name (e.g., uid=myusername & gid=myusername). These mappings are used when creating any new files. e.g., when you touch a new file it will be written to disk with owner=YourUID and group=PrimaryGID, along with your umask settings (see umask wiki). The groups that you are a member of can be listed with the command id (see id manpage), e.g., % id uid=0(root) gid=0(root) groups=0(root),1(bin) % touch test1 % ls -l test1 -rw-r--r-- 1 root root 0 Jan 1 00:00 test1 You can change this PrimaryGID value in your current terminal session to any of the other groups listed that you are a member of [e.g., groups=0(root),1(bin)] with the command newgrp (newgrp manpage), e.g., % newgrp bin % id uid=0(root) gid=1(bin) groups=0(root),1(bin) % touch test2 % ls -l test2 -rw-r--r-- 1 root bin 0 Jan 1 00:02 test2 As you can see above, the root user's default GID is now set to bin [gid=1(bin)]. Note: You cannot simply add "newgrp OTHERGROUP" to your login script. 'newgrp' is a subshell. Therefore, if you do this it will create a shell-login loop (launching a shell within a shell until all of your allocated processes are used up). You need to check with an if statement what your current group is, and only execute newgrp if your new target group is not "OTHERGROUP". For example,
#!/bin/tcsh if ( `id -gn` != "coaps" ) newgrp coaps #!/bin/bash if [ `id -gn` != "coaps" ]; then newgrp coaps; fi |



