---
title: "How access is decided"
description: "Understand why Alpacon allows, holds or refuses an action. Follow identity, session scope, access rules and MFA across people, AI agents and automation jobs."
---

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

# How access is decided

The same command can run for one caller, wait for approval for another, and be refused on a different server. Alpacon considers who is acting, the account and access they have, and the action they want to take. An AI rating informs some decisions; it does not grant access by itself.

## People, AI agents, automation and Alpamon

| Actor | Identity and access |
| --- | --- |
| Person | A workspace user with roles and server access. Personal API tokens cannot be issued with command-execution or file-transfer scopes; use [service tokens](/use/iam/applications/service-tokens/) for those tasks. |
| AI agent | Acts through a user or application identity in a declared agent mode. An agent name is self-reported; it is not a separate user account or proof of identity. |
| CI/CD automation | An application using a service token, limited by its scopes and server, command and file access rules. |
| Alpamon | Software installed on a managed server. It is distinct from an AI agent requesting a work session. |

The CLI is a way to connect, not an actor type. A signed-in CLI client can be used by a person or an AI agent. A session requested with a personal API token, through MCP, by a CLI that declares an agent, or by an unidentified client is put into agent mode. See [Request a session](/use/work-sessions/create/).

## Identity and the account you use

Your workspace identity determines what you may request. The server account determines who the session runs as. These are separate questions: being allowed onto a server does not make every account on it available.

Your own account, a shared account and a service account can require different decisions. Another person's personal account is always refused, including for administrators and in advisory mode. A rule or approval cannot lift that restriction. The same restriction applies when `sudo`, `su` or `runuser` switches accounts.

See [Choose the server account](/use/work-sessions/account-selection/) for the task and [Access rules reference](/reference/access-rules/#default-account-rules) for the defaults and deployment qualifications.

## The work session or token boundary

A work session defines the servers, features, account and time window covered by the request. Alpacon decides whether to admit the session, then separately checks commands and sudo inside it. Session approval does not authorize arbitrary root commands. The session must include sudo before sudo rules can help.

A service token can run automation without a work session, within the application's approved access. That path uses token rules, not the human session-admission defaults. A token command attached to a work session also has that session's limits and can follow its command-approval path. Compare [token types](/reference/tokens/) before choosing credentials.

## How rules use risk ratings and signals

For a rated action, Alpacon combines the applicable rule with the AI's categorical rating and relevant signals. A command that departs from the session's purpose, or runs more than the line that was assessed, can require a person even when its rating would otherwise allow it.

Within an action's approval rules, the first matching enabled, unexpired workspace rule takes precedence over the built-in defaults. A rule can be stricter or less restrictive than a default, but it cannot remove every check. Scope and account restrictions still apply, and an unreviewed Critical sudo cannot be made automatic by an Allow rule.

Commands typed in a web terminal are not assessed one by one as submitted commands are. Sudo has its own check, and terminal activity is recorded for later review. Follow the notice in the Web terminal section: when it shows **The rules under Commands decide sudo here too.**, the sudo rules under **CLI and API** also decide web-terminal sudo.

## Presence, MFA and approval

MFA confirms that a person is present. Approval confirms that the requested access or action is permitted. One does not always replace the other: an approved terminal sudo can still require MFA.

A person may need to verify again when their recent MFA no longer covers the action. A non-interactive command cannot display that challenge; complete verification in a supported signed-in client and retry. An AI agent's approved session supplies the authorization used instead of asking the agent to complete a human MFA prompt.

## Why defaults differ by action

Session admission, sudo and command execution answer different questions. A Superuser's session can be admitted automatically while its sudo still needs review. An agent's session normally waits for a person, even though some commands within an approved session can run automatically. A service token has its own risk defaults and cannot wait for sudo approval in the same way.

Use the [default decision tables](/reference/access-rules/) for the exact actor and action. The familiar person-versus-agent risk bands describe the default sudo risk decision, not a universal rule for all access.

## Advisory and enforce

Enforce applies the relevant execution-control decisions. Advisory records judgments without holding or refusing actions because of those judgments. Under advisory, session admission, sudo and command execution never create an approval request. Requests for a permission the person does not hold, such as a standing sudo policy, service-token issuance or changes, or username or account approval, still go to approvers as usual. New sessions do not wait for execution-control approval, but account denies still apply. Scope restrictions, credential permissions and credential-exposure checks still refuse actions they do not permit.

Advisory does not grant standing sudo authority. Terminal sudo without the required authority or a matching policy is still refused with `sudo_no_authority`. Requests already pending when the mode changes stay pending under their existing expiry rules. Submit a new request if you need the new posture to apply.

## Sudo authorized for one session

A standing sudo policy names the people, servers and commands it covers. A session-bound policy lasts only for its work session and can let the session's approval take the place of repeated MFA for those commands. The policy stops applying when the session ends; its account, server, command and time restrictions still matter.

This is different from approving one held command. That approval can cover sudo explicitly shown in that command's line, subject to remaining scope, account and workspace restrictions. It does not authorize unseen elevation inside a script or a later unrelated command.

See [sudo with MFA](/use/work-sessions/terminal/sudo-with-mfa/) and [sudo command patterns](/reference/cli/work-session/create/#sudo-command-patterns).

## Find the decision and recover

Use [Access rules](/use/policies/access-rules/) to preview who a rule matches and why. For an action already attempted, open its command, sudo or approval record. Check the reported reason and the current request state before retrying: a refusal code alone does not mean an approval is still pending.

The [related error codes](/reference/access-rules/#related-error-codes) distinguish missing session scope, MFA, authority and risk decisions. Change the part that caused the refusal; retrying an unchanged request does not supply missing access.

Source: https://docs.alpacax.com/learn/how-access-is-decided/
