---
title: "alpacon work-session update"
description: "Update an Alpacon work session from the CLI. Change its title, description, scopes, servers, or schedule, and request additional sudo command patterns."
---

> Full documentation index: https://docs.alpacax.com/llms.txt

# alpacon work-session update

Update a work session or add sudo command patterns.

## Usage

`alpacon work-session update [SESSION_ID] [flags]`

## Key facts

- Only supplied fields change; editable fields depend on session status.
- `--scope` and `--server` replace their entire lists.
- `--sudo` adds patterns to existing policies.
- Without an ID, use `ALPACON_WORK_SESSION`, then the workspace's active session.

## Flags

### Session fields

| Flag | Type | Description |
| --- | --- | --- |
| `--description` | `string` | New session description (markdown supported) |
| `--expires-at` | `string` | New absolute expiry time (RFC3339; pending sessions only—use 'extend' for approved/active sessions) |
| `--scope` | `strings` | Replace the session scopes. Valid: command, editor, sudo, tunnel, webftp, websh (repeatable; comma-separated values also accepted; replaces the whole list) |
| `--server` | `strings` | Replace the target servers by name (repeatable; comma-separated values also accepted; replaces the whole list) |
| `--starts-at` | `string` | New scheduled start time (RFC3339; pending sessions only) |
| `--title` | `string` | New session title |

### Sudo and output

| Flag | Type | Description | Default |
| --- | --- | --- | --- |
| `-h, --help` | `bool` | help for update | `false` |
| `--sudo` | `stringArray` | Sudo command patterns for policies where session approval takes the place of MFA (repeatable; each value is a comma-separated pattern list forming one policy, wildcards allowed) | — |
| `--sudo-reason` | `string` | Justification applied to the sudo policies added via --sudo | — |
| `--output` | `string` | Output format: table or json | `table` |

## Examples

Update the title and description

```bash
alpacon work-session update ses-abc123 --title "deploy v2" --description "rollout"
```

Replace the target servers

```bash
alpacon work-session update ses-abc123 --server web-01,db-01
```

Replace the scopes

```bash
alpacon work-session update ses-abc123 --scope command,websh
```

Reschedule a pending session

```bash
alpacon work-session update ses-abc123 --starts-at 2027-01-15T10:00:00Z --expires-at 2027-01-15T12:00:00Z
```

Add a sudo command pattern to a specific session

```bash
alpacon work-session update ses-abc123 --sudo "systemctl restart nginx"
```

Add a pattern to the current effective session

```bash
alpacon work-session update --sudo "tail -f /var/log/nginx/*.log"
```

## Details

Update fields of an existing work session.

Only the flags you pass are changed; the rest are left untouched. Which fields the server accepts depends on the session status (e.g. `--starts-at`/`--expires-at` on a pending session; `--sudo` on an approved/active one). The CLI sends what you provide and surfaces the server's validation error if a field isn't editable for the current status (`--sudo` is also validated locally before the request).

`--scope` and `--server` replace the whole list (not append). `--sudo` adds command patterns to the session's sudo policies, where the session approval takes the place of MFA. Use it when an `exec` sudo was denied. In Enforce mode, the additions wait for a person's approval; Advisory mode refuses them, as described below.

If `SESSION_ID` is omitted, the effective work session is resolved from the `ALPACON_WORK_SESSION` environment variable, then the workspace's active session (set via [`alpacon work-session use`](/reference/cli/work-session/use/)).

## Sudo command patterns

`--sudo` patterns here follow the same matching rules as on [`work-session create`](/reference/cli/work-session/create/): the `sudo` prefix is not part of the matched command, the whole command must match the whole pattern, `*` is the only wildcard, and compound commands are split on shell operators so each part must match a pattern. See [Sudo command patterns](/reference/cli/work-session/create/#sudo-command-patterns) for the full rules and worked examples.

In an Enforce workspace, adding a sudo policy from the CLI, MCP, an API token, or a service token (with `--sudo` on the CLI) waits for approval, even for a Superuser, when the session approval takes the place of MFA. In an Advisory workspace it is refused with HTTP 403 and `work_session_sudo_bypass_console_only`; add it in the web console instead. An approver has to decide it in the web console, because it creates standing authority and needs MFA there; Slack only links to the console for this request.

Outside that `--sudo` approval request, creating a sudo policy or widening one through those channels (more commands, users, or servers; an earlier start or later end; session approval set to take the place of MFA; or a move to another session) is refused with `sudo_policy_console_only`. Make that change in the console. Narrowing or deleting a policy works from any channel.

Source: https://docs.alpacax.com/reference/cli/work-session/update/
