# SSH access

Source: https://tiltas.openpanel.sh/docs/ssh

> What SSH rules do today, what is not working yet, and how to reach your Servers over SSH now.

**SSH rules** say who may sign in to which Servers over SSH, and as which system users. Part of this works today and
part does not. This page says which is which.

## What works today

An SSH rule **opens port 22** of the chosen Servers to the chosen people. Their SSH client then reaches the Server's
own SSH server (OpenSSH, usually), which signs them in **with its usual keys or passwords**, as on any network.

So today an SSH rule is a firewall rule for port 22 that you write per person and per Server:

```bash
ssh deploy@home
```

`home` is the Server's name in your Network. The Server's SSH server must allow `deploy` with a key or password you
have.

## What does not work yet

**Not on yet**

- **Signing in with your Network identity, without SSH keys or passwords.** Tiltas has its own SSH server for this,
  but nothing switches it on for the Servers an SSH rule names yet, so port 22 still goes to the Server's own SSH
  server.
- **"Sign in again first"**, which `root` always needs. A rule with it asks for a confirmation page that is not
  built yet, so the session cannot start. Do not add rules for `root` or with "Sign in again first" for now.
- **SSH sessions in the audit log.** Changes to SSH rules are recorded; the sessions themselves are not yet.

These three are being built. When they ship, an SSH rule will also sign people in as the system users it names, with no
key or password, and every session will be in the [audit log](/docs/people/audit-log). The rules you write now keep their
meaning.

## Add an SSH rule

Owners and Admins write SSH rules.

In the [console](/app), open **SSH access** and choose **Add SSH rule**.

- **Who**: Members or Groups.
- **Servers**: Servers or Groups of Servers. SSH rules apply to Servers only, not to Personal devices.
- **As system users**: the users on those Servers, separated by commas, such as `deploy, jonas`. Leave out `root`.
- Leave **Sign in again first** off.
- **Note**: why the rule exists (optional).

Choose **Add SSH rule**. The Servers pick up the change within seconds.

Each Device's page lists the SSH access it has, as `ssh deploy@home`, under
[What this Device can reach](/docs/access/check-reach).

## Or use an Access rule

An [Access rule](/docs/access) to a Device on port `22` opens SSH the same way today, and can also name Personal devices
as the destination. Use an SSH rule when you want the rule to carry over to Tiltas's own sign-in once it ships.

## With the API

```bash
curl -X POST https://tiltas.openpanel.sh/api/v1/accounts/acc_your_account/ssh-rules \
  -H "Authorization: Bearer $TILTAS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"description": "deploys", "sources": {"members": ["mem_your_member"]}, "servers": {"devices": ["dev_your_server"], "groups": []}, "users": ["deploy"], "check": false}'
```

See [Create an SSH rule](/docs/api/access/createSshRule). A rule for `root` without `"check": true` is refused with
`422` `invalid_rule`.
