# Restricting Network Access

_Peios / Using Peios / Sharing Folders_

> Limit what people can do through a share, whatever the files' own permissions allow, with a preset or a list of people and groups.

Restrict a share's network access when people should be able to do less
over the network than on this machine, such as only reading files they could
change at the console. A share's network access only ever narrows the files'
own permissions; to let someone use files they can't use now, change the
files' permissions instead.

## Before you start

- Sign in as a member of Administrators.
- Decide whether a preset fits. Most needs are one of these:
  - **No network restriction**: each file's own permissions decide. This
    is the default.
  - **Read-only for everyone signed in**: nobody can change files through
    the share.
  - **Administrators can change; others read**: only Administrators can
    change files through the share.

  Both restrictions grant signed-in people only, so they refuse anonymous
  connections even on a share that allows them.

## Choose a preset

In File Sharing, open the share's page, and choose **Use** beside the
preset under **Network Access**. Or run `fserv share set` with the preset's
name, `open`, `read-only` or `admins-change`:

```sh
fserv share set Projects --access read-only
```

## Choose specific people and groups

1. In File Sharing, open the share's page.
2. Under **Network Access**, choose **Choose…** beside **Specific people
   and groups**.
3. Choose **Add…** to add the people and groups who can use the share, and
   give each **Read**, **Change**, or **Full control**. Remove the entries
   for anyone who shouldn't use it, including **Authenticated Users**,
   which a share without a restriction starts with. To admit anonymous
   connections on a share that allows them, grant **Everyone** instead.
4. Choose **OK**.

From the command line, give the share a security descriptor in SDDL. This
one lets Administrators change files and every signed-in person read them:

```sh
fserv share set Projects --security 'O:BAG:BAD:(A;;0x1301bf;;;BA)(A;;0x1200a9;;;AU)'
```

The rights are read (`0x1200A9`), change (`0x1301BF`), and full control
(`0x1F01FF`). To name one group, put its security identifier in place of
`AU`.

## Check the result

Run `fserv share show Projects`. **Access** names the preset in use, or says
`Custom network permissions`. The change applies to new connections within
a few seconds; anyone already connected keeps the access they connected
with until they disconnect.

Connect as someone the share should restrict, and try the change it
should refuse. A share that grants someone nothing refuses their connection
outright, and fservd records `fservd.share.connected` with
`access-denied`.

Related content:

- [File Sharing](/peios/using-peios/sharing-folders/file-sharing.md)
- [Sharing a Folder](/peios/using-peios/sharing-folders/sharing-a-folder.md)
