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

FlagTypeDescription
--descriptionstringNew session description (markdown supported)
--expires-atstringNew absolute expiry time (RFC3339; pending sessions only—use ‘extend’ for approved/active sessions)
--scopestringsReplace the session scopes. Valid: command, editor, sudo, tunnel, webftp, websh (repeatable; comma-separated values also accepted; replaces the whole list)
--serverstringsReplace the target servers by name (repeatable; comma-separated values also accepted; replaces the whole list)
--starts-atstringNew scheduled start time (RFC3339; pending sessions only)
--titlestringNew session title

Sudo and output

FlagTypeDescriptionDefault
-h, --helpboolhelp for updatefalse
--sudostringArraySudo 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-reasonstringJustification applied to the sudo policies added via —sudo—
--outputstringOutput format: table or jsonSee defaults

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).

Sudo command patterns

--sudo patterns here follow the same matching rules as on 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 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.

Last updated: