# A terminal on a running job

Open a shell in a job's VM while it runs, to look at what it is doing: from the job's page in the dashboard (**Open terminal**), or from your own terminal with the job's id (the one in its dashboard address).

```
groundbox ci ssh <job id>                    # a shell, as the runner user (sudo works)
groundbox ci ssh <job id> -- cat /var/log/runner.log   # one command
```

- **Who:** owners, admins and members of the job's team, or an API key with `ci:write`. Nobody reaches another team's jobs. Every session is recorded for the team: who, from where, when and how it ended.
- **How:** through the Groundbox API, over the connection the machine keeps to it. No port is open on the VM and no SSH key is involved, so plain `ssh` does not connect to it.
- **How long:** a session ends when the job's VM does, and after 60 minutes at most (open a new one to go on). At most 4 sessions are open on a job at once, and a team can start 10 a minute.

**Debug a failed job:** a job's VM normally goes the moment the job ends. To keep it a while for a terminal, either set *Keep a failed job's VM* in Settings → Team (every failed job's VM stays that long), or ask for it in the workflow:

```
      - if: failure()
        run: groundbox-debug-hold 15   # minutes, at most 30
```

The held time is billed by the second like the job, at most 30 minutes, and the job's 6-hour limit still holds. Run `groundbox-debug-hold done` in the terminal to let the VM go sooner. On a runner that is not Groundbox's the command does nothing.
