How do I change groups?

If you have one username in multiple groups, in order for resources to be charged to the correct group, you will need to specify the group to be charged, if that is not your current group.

You can see your current group by using the following command.

id  –ng 

You can change groups by using the following command, replacing groupname with the group you want to use. 

newgrp groupname

The change will last for the duration of the login session only; to permanently change your primary group use the online change group tool.

In order for SUs to be charged to the correct group you will need to use the -A option in your Slurm script, replacing groupname with the group you want to use.

#!/bin/bash -l
#SBATCH -A groupname

If you have enabled trusted X11 forwarding by using the "ssh -Y" command, you must use the following commands to change groups. First, you must obtain the value of the "DISPLAY" variable in the original group.

echo $DISPLAY

Next, you must identify the corresponding xauth cookies by running the following command, replacing displaynumber with the number output from the previous step.

xauth list | grep \:displaynumber

Change to the new group with the "newgrp" command as explained above. Next, run the following commands, replacing displayvalue with the full value of the "DISPLAY" variable as output by the "echo $DISPLAY" command, and replacing xauthlistvalue with one of the lines from the "xauth list" command above.

export DISPLAY=displayvalue

xauth add xauthlistvalue

Note that you must run the "xauth add" command for each line output by the "xauth list" command. Another way to run a program under a different group is to use the "sg" command as shown below, replacing program with the program you'd like to run, and groupname with the name of the group under which you'd like to be running the program.

module load program

sg groupname

Additionally, if you would like to change groups within a Slurm script, you must include the last line in the header, replacing groupname with the name of the group under which you'd like to be running the script.

#!/bin/bash -l

#SBATCH -A groupname

 

Changing your Primary Group

If the majority of your work has transitioned to a new group, you may want to update your primary group to avoid the additional steps in order to work with that group. You can update your primary group here on the MSI website by visiting this page.

Category: 
Jobs