Skip to content

jitsudo exec

Execute a single command in a subprocess with elevated credentials injected into its environment.

jitsudo exec <request-id> -- <command> [args...]

jitsudo exec fetches the active credentials for an approved elevation request and executes the specified command in a subprocess with those credentials injected as environment variables.

Key security property: The parent shell never receives the credentials. They exist only in the child process’s environment and are discarded when the child exits.

The subprocess inherits all environment variables from the parent, with the provider-specific credential variables appended. The child process’s stdin, stdout, and stderr are connected directly to the terminal.

If the child exits with a non-zero code, jitsudo exec exits with the same code.

The request must be in ACTIVE state. If it is still PENDING or APPROVED, wait for the approver to act first.

ArgumentDescription
<request-id>The ID of an active elevation request
--Separator between jitsudo flags and the command to run
<command> [args...]The command and its arguments to execute
FlagDefaultDescription
--server <url>Stored credentialsControl plane URL
--token <token>Stored credentialsBearer token override
-q, --quietfalseSuppress non-essential output
--debugfalseEnable debug logging
Terminal window
# Run an AWS CLI command with elevated credentials
jitsudo exec req_01J8KZ4F2EMNQZ3V7XKQYBD4W -- \
aws ecs describe-tasks --cluster prod --tasks abc123
# Run kubectl against a production cluster
jitsudo exec req_01J8KZ4F2EMNQZ3V7XKQYBD4W -- \
kubectl get pods -n production
# Inspect the injected environment variables
jitsudo exec req_01J8KZ4F2EMNQZ3V7XKQYBD4W -- env | grep AWS_
# Run a script
jitsudo exec req_01J8KZ4F2EMNQZ3V7XKQYBD4W -- ./scripts/rotate-keys.sh
# Run terraform with elevated AWS credentials
jitsudo exec req_01J8KZ4F2EMNQZ3V7XKQYBD4W -- \
terraform apply -auto-approve -target=module.eks

The variables injected depend on the provider:

ProviderVariables injected
awsAWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN, AWS_DEFAULT_REGION
gcpGOOGLE_CLOUD_PROJECT
azureAZURE_SUBSCRIPTION_ID
kubernetesJITSUDO_K8S_ROLE, JITSUDO_K8S_NAMESPACE
jitsudo execjitsudo shell
Use caseRun a single known commandExplore interactively
SessionShort-lived subprocessInteractive shell session
Audit trailSingle exec eventShell open/close events

Use jitsudo exec in scripts and CI pipelines. Use jitsudo shell for interactive investigation.