# Sharing files on /scratch

## History

In the past `/scratch` directories were readable by others by default. Due to increase security requirements for grant funding, this default has been removed.

We understand some people relied on being able to access other users' `/scratch` areas. So we have some methods to return that functionality in a more secure manner, or some possible alternatives to achieve the same goal.

## Guide

### Preferred sharing methods

#### Option 1: Share with Enterprise Groups

You can share (read-only) your scratch directory easily with an enterprise group you belong to, mimicking access to `/projects`.

```bash
# replace BIO-FAKE-Group with your enterprise group
chgrp BIO-FAKE-Group /scratch/$USER
chmod 750 /scratch/$USER      # 750: rwxr-x---
```

You can either use an existing enterprise group or [create your own](<https://nau.service-now.com/sp?id=kb_article&amp;article=KB0014689>).

> [!TIP]
>
> Enterprise groups can be members of other enterprise groups, so if you need to share your `/scratch` with multiple groups, you can create a group with the other groups as members without adding each person individually.

#### Option 2: Share with `/common/contrib` or `/projects`

If you're sharing research data or data sets amongst your lab or other HPC researchers, you may want to consider using space on either `/common/contrib` or `/projects` instead.

- `/common` is a great place to share publicly available datasets or custom software that need to be referenced/accessed by many researchers. [Please get in contact with the ARC team if you'd like to make data available here](<https://rcdata.nau.edu/hpcpub/docs-test/contact-us.html>).
- `/projects` is a great place to share research data amongst your colleagues. These are restricted access areas limited to individual groups, so are the ideal place for long-term storage of unpublished research data. If your research group doesn't have a space on `/projects` yet you (or your faculty sponsor) can [request up to 5TB of free space](<https://in.nau.edu/arc/request-storage/>).

### Less secure options

> [!WARNING]
>
> **PLEASE READ THIS**
>
> *You* are ultimately the one responsible for your research data. As such, while we have set more secure defaults, you can still choose to restore the previous behavior of your `/scratch` directory being readable by everyone. Before you do this, be sure you understand the [ramifications by reviewing NAU data classification and handling policies](<https://in.nau.edu/university-policy-library/data-classification-and-handling/>). The section on "University Research" in the [Data Type Examples document](<https://rcdata.nau.edu/hpcpub/docs-test/assets/in.nau.edu/university-policy-library/wp-content/uploads/sites/395/Data-Type-Examples-1.pdf>) is particularly useful — where "unpublished research data" is automatically considered Level-3 data.

#### Option 3: Share with the cluster group

A slightly more secure option than re-opening your `/scratch` directory to everyone, is to use the `cluster` group instead. This group contains all Monsoon HPC users, excluding those students who only have access through a classroom.

Use the following command to change your `/scratch`‘s permissions:

```bash
chgrp cluster /scratch/$USER
chmod 750 /scratch/$USER      # 750: rwxr-x---
```

#### Option 4: Make your directory world-readable again

If you've reviewed the warning above and are confident that *sharing your scratch with everyone* falls within NAU's data handling guidelines, you can restore the previous behavior of allowing anyone to read your `/scratch` directory with the following command:

```bash
chmod 755 /scratch/$USER      # 755: rwxr-xr-x
```

### Resetting your /scratch permissions

If you want to change the permissions on your `/scratch` back to normal, you can use `chmod` and `chgrp` to set the permissions to their old values:

```bash
chgrp cluster /scratch/$USER
chmod 700 /scratch/$USER      # 700: rwx------
```
