# Shares and access

> For the complete documentation index, see [llms.txt](https://docs.ringleader.dev/llms.txt).


> Share a workstation, a secret or a workstation pool with a teammate, revoke access, and report effective access.


The `share` and `unshare` commands create and delete [Grants](https://docs.ringleader.dev/organizations-teams/accounts-access/roles-grants/#grants). [Workstation and Secret sharing](https://docs.ringleader.dev/organizations-teams/accounts-access/workstation-secret-sharing/) explains what a share gives and how to use it.

## `rl workstation share <name>`

Grant one or more subjects **SSH access** to a workstation you own, or one owned by a service
account you own. This creates a `Grant` object, and Ringleader adds the beneficiaries' node keys
to the workstation's authorized keys. [Workstations that cannot be shared](https://docs.ringleader.dev/organizations-teams/accounts-access/workstation-secret-sharing/#workstations-that-cannot-be-shared) says why some workstations cannot be shared.

```bash
rl workstation share my-box --with user:alice@acme.com
rl workstation share my-box --with user:alice@acme.com --with sa:dev/ci
rl workstation share --all --with user:alice@acme.com   # every workstation you own
```

| Flag | Description |
|------|-------------|
| `--with <subject>` | Beneficiary subject (e.g. `user:alice@acme.com`, `sa:dev/builder`), repeatable. |
| `--all` | Target every workstation in the namespace (`matchName: *`). |
| `--admin` | Elevated path: grant on **any** subject's workstation (gated by RBAC; stamps an admin-scope Grant). |
| `--allow-missing` | Create the Grant even if the target does not exist yet (pre-provisioning): skips only the existence check. |
| `--dry-run` | Print the generated Grant instead of applying it. |
| `-o, --output <format>` | `yaml` (default) or `json`. Prints the Grant and creates nothing. |
| `-n, --namespace <ns>` | Namespace. |
| `--as <subject>` | Impersonate a subject. |
| `--home <dir>` | Data directory. |

[Rights a share grants](https://docs.ringleader.dev/organizations-teams/accounts-access/workstation-secret-sharing/#rights-a-share-grants) says what a share does and does not carry.

## `rl secret share <name>`

Grant subjects the **`access`** right on a secret you own, or on one owned by a service account
you own: the right to read its values and to admit objects that consume it.

```bash
rl secret share db --with user:alice@acme.com
rl secret share --all --with sa:dev/builder
```

Flags are identical to `workstation share` (`--with`, `--all`, `--admin`,
`--allow-missing`, `--dry-run`, `-o`, `-n`, `--as`, `--home`), with one difference
that matters: `--admin` does **not** let you share a secret a person owns. It shares your
own secrets and those owned by any service account in the namespace, as
[Secret sharing](https://docs.ringleader.dev/security/credentials/secret-handling/#secret-sharing) explains.

## `rl workstationpool share <name>`

Grant subjects the **`lease`** right on a [workstation pool](https://docs.ringleader.dev/reference/resources/workstationpool/)
you own, or on one owned by a service account you own: the right to lease a member from it. The
Grant opens the pool, not its members. A member is reached through the lease that holds it.

```bash
rl workstationpool share agents-linux --with user:alice@acme.com
rl workstationpool share agents-linux --with sa:dev/ci
```

The flags are the ones `workstation share` takes (`--with`, `--all`, `--admin`,
`--allow-missing`, `--dry-run`, `-o`, `-n`, `--as`, `--home`). `--admin` reaches pools the way it
reaches secrets: your own and those a service account in the namespace owns, never a pool a person
owns.

Before it writes the Grant, the command warns about two things a pool's owner should know. Each
line is advice: the share goes ahead either way.

- When a person owns the pool, it prints that every device of that person can open a shell on
  every member, including members someone else leases, and that a pool many people share is
  usually owned by a service account.
- When the pool recycles, it prints that a recycled member keeps whatever its last holder left
  unless an `onRecycle` script removes it, including files, running processes, and SSH keys
  added outside the block Ringleader manages.

[`rl workstationpool create`](https://docs.ringleader.dev/reference/cli/commands/workstation-access/#rl-workstationpool-create-name)
prints the same two warnings, the first when you are a person and the second with `--recycle`.

`rl workstationpool unshare` deletes the Grant, and `rl workstationpool access` reports who can
lease from the pool and through which Grant. Both take the flags their `workstation`
counterparts below take.

## `rl workstation unshare` / `rl secret unshare`

Revoke a share **you created**: deletes the matching `Grant`. Name the same
target and beneficiaries the share used. `--admin` deletes the admin-scope Grant.

```bash
rl workstation unshare my-box --with user:alice@acme.com
rl secret unshare db --with user:alice@acme.com
```

| Flag | Description |
|------|-------------|
| `--with <subject>` | Beneficiary the share named, repeatable. |
| `--all` | The share targeted every object of the kind (`matchName: *`). |
| `--admin` | Delete the admin-scope Grant. |
| `-n, --namespace <ns>` | Namespace. |
| `--as <subject>` | Impersonate a subject. |
| `--home <dir>` | Data directory. |

## `rl workstation access` / `rl secret access`

Report **effective access**: who can reach the resource and through which grant
(ownership vs. an explicit Grant). `workstation access` reports who can SSH to the
workstation; `secret access` reports who can read the secret's value.

```bash
rl workstation access my-box
rl secret access db
```

| Flag | Description |
|------|-------------|
| `-n, --namespace <ns>` | Namespace. |
| `--as <subject>` | Impersonate a subject. |
| `--home <dir>` | Data directory. |

## `rl share show`

List the shares in play: the ones **you created** (shared out) and the ones
**provided to you** (where you are a beneficiary). Optionally narrow to a single
kind (`workstation` or `secret`).

```bash
rl share show                 # everything: yours + provided to you
rl share show workstation     # only workstation shares
rl share show --mine          # only shares you created
rl share show --to-me         # only shares provided to you
rl share show --enabled       # only currently-enabled shares
```

| Flag | Description |
|------|-------------|
| `--mine` | Only Grants you created (shared out). |
| `--to-me` | Only Grants provided to you (you are a beneficiary). |
| `--enabled` | Only enabled shares. |
| `--disabled` | Only disabled (paused) shares. |
| `-o, --output <format>` | `table` (default) or `json`. |
| `-n, --namespace <ns>` | Namespace. |
| `--as <subject>` | Impersonate a subject. |
| `--home <dir>` | Data directory. |

## `rl share disable` / `enable`

Pause a share without deleting it, then resume it later. This flips the Grant's
`spec.enabled` flag rather than removing it, so the beneficiary list and scope are
preserved. A disabled share grants nothing until re-enabled.

```bash
rl share disable workstation my-box --with user:alice@acme.com
rl share enable  workstation my-box --with user:alice@acme.com
rl share disable secret db --with user:alice@acme.com
```

Each takes a `workstation` or `secret` subcommand and names the same target and
beneficiaries the share used (`--with`, repeatable; `--all` for a `matchName: *`
share), plus the usual `-n`, `--as`, and `--home`.

Without `--admin`, a share creates an owner-scope Grant. With `--admin`, it creates an admin-scope Grant, which needs namespace-admin rights. [Grant scope](https://docs.ringleader.dev/organizations-teams/accounts-access/roles-grants/#grant-scope) says what each reaches.

