# Working with Multiple Groups ## How do I Change Groups? At MSI, we use unix groups to represent MSI "projects". You might be in more than one MSI project, which means you have more than one unix group associated with your username. The below provides ways of switching which unix group/MSI project is currently active for your session. You can see your current group by using the following command. ```bash id -ng ``` You can change groups by using the following command, replacing *groupname* with the group you want to use. ```bash newgrp ``` The change will last for the duration of the login session only; to permanently change your primary group use the online change group tool. To run a job on a different group, you may use the `-A` option in your Slurm script, replacing *groupname* with the group you want to use. ```bash #!/bin/bash -l #SBATCH -A ``` 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. ```bash 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. ```bash xauth list | grep \: ``` 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. ```bash export DISPLAY= xauth add ``` 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. ```bash module load sg ``` 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. ```bash #!/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 myMSI by visiting the [Change Group page](https://mymsi.msi.umn.edu/user/primary-group).