Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

feat(pam): default ssh access to interactive shell

Andreya5b8c5c261d5
diff --git a/docs/cli/commands/pam.mdx b/docs/cli/commands/pam.mdx
index 4eb751d2ac..6908572f3e 100644
--- a/docs/cli/commands/pam.mdx
+++ b/docs/cli/commands/pam.mdx
@@ -4,7 +4,7 @@ description: "Access a PAM-managed database, server, or cloud account from your
---
```bash
-infisical pam access <path> [flags]
+infisical pam access <path> [flags] [-- <command>]
```
## Description
@@ -13,6 +13,8 @@ Open one PAM-managed account for your own use, brokered through Infisical's [Gat
This single command handles every account type: the CLI adapts its behavior to whichever type the account's template defines (see [Account Types and Behavior](#account-types-and-behavior) below).
+SSH accounts connect you directly to a shell on the target. Every other account type starts a local proxy or credential helper that you point your own client at.
+
<Note>
To open several accounts at once for an AI agent, use [`infisical pam agentic access`](/cli/commands/pam-agentic) instead, which can also authenticate as a [machine identity](/documentation/platform/identities/machine-identities) so an agent can run unattended.
</Note>
@@ -22,9 +24,21 @@ This single command handles every account type: the CLI adapts its behavior to w
| Argument | Description |
|----------|-------------|
| `<path>` | **Required.** Path to the PAM account in format `folder/account-name` |
+| `<command>` | Optional, after `--`. A command to run on the target instead of opening a shell. SSH accounts only. |
## Flags
+<Accordion title="--proxy">
+ Start a local proxy to point your own client at, instead of connecting you to the target.
+
+ Only SSH accounts connect directly today, so this only changes behavior for them. Use it for SCP, SFTP, rsync, port forwarding, GUI clients, or anything that needs your `~/.ssh/config`.
+
+ ```bash
+ # Example
+ infisical pam access servers/prod-bastion --proxy
+ ```
+</Accordion>
+
<Accordion title="--duration">
Session duration. Supports Go duration format (e.g., `1h`, `30m`, `2h30m`).
@@ -48,6 +62,8 @@ This single command handles every account type: the CLI adapts its behavior to w
<Accordion title="--port">
Local proxy port. Use `0` for auto-assign.
+ For SSH accounts this requires `--proxy`, since a port is only meaningful when a proxy is running.
+
Default value: `0`
```bash
@@ -115,14 +131,32 @@ Based on the account's template, the CLI starts the appropriate local proxy or c
</Accordion>
<Accordion title="SSH">
- Starts a local SSH proxy. Use standard SSH/SCP/SFTP/rsync commands to connect.
+ Connects you straight to a shell on the target.
```bash
- # Start the proxy
infisical pam access servers/prod-bastion
```
- Then connect using your SSH client:
+ Type `exit` or press `Ctrl+D` to end the session. The remote shell's exit code becomes the command's exit code.
+
+ **Run a single command**
+
+ Put it after `--`. Output streams through, so this composes with pipes and scripts:
+
+ ```bash
+ infisical pam access servers/prod-bastion -- systemctl status nginx
+ infisical pam access servers/prod-bastion -- df -h | grep /var
+ ```
+
+ **Use your own client**
+
+ `--proxy` starts a local SSH proxy instead, for file transfer, port forwarding, `~/.ssh/config`, or a GUI client:
+
+ ```bash
+ infisical pam access servers/prod-bastion --proxy
+ ```
+
+ Then connect to the port it prints:
```bash
# SSH
@@ -265,4 +299,3 @@ infisical pam access production/database --reason "Investigating incident INC-12
| `a reason is required to access this account` | Policy requires reason, no TTY | Pass `--reason` flag |
| `Gateway does not support '{type}' PAM accounts` | Gateway version too old | Upgrade Infisical Gateway |
| `PAM response metadata is missing` | API response incomplete | Contact support |
-
diff --git a/docs/documentation/platform/pam/accounts/ssh.mdx b/docs/documentation/platform/pam/accounts/ssh.mdx
index f587979e4c..359697f710 100644
--- a/docs/documentation/platform/pam/accounts/ssh.mdx
+++ b/docs/documentation/platform/pam/accounts/ssh.mdx
@@ -69,21 +69,30 @@ SSH accounts support three authentication methods: password, public key, and cer
You get a full shell. To disconnect, type `exit` or close the tab.
</Tab>
<Tab title="CLI">
- The CLI starts a local proxy that you connect to with your SSH client.
+ The CLI connects you straight to a shell on the server.
```bash
infisical pam access prod-servers/web-01
```
- The command outputs the local port to connect to. Then use your SSH client:
+ To disconnect, type `exit` or press `Ctrl+D`.
+
+ To run a single command and exit, put it after `--`:
+
```bash
- ssh deploy@localhost -p <port>
+ infisical pam access prod-servers/web-01 -- systemctl status nginx
```
- No password or key needed since the proxy handles authentication.
+ For file transfer, port forwarding, or your own SSH client and `~/.ssh/config`, use `--proxy` to
+ get a local port instead:
+
+ ```bash
+ infisical pam access prod-servers/web-01 --proxy
+ ```
**Flags:**
- - `--port <port>` — use a specific local port (otherwise one is assigned automatically)
+ - `--proxy` — start a local proxy instead of connecting you, for SCP, SFTP, rsync and port forwarding
+ - `--port <port>` — use a specific local port (requires `--proxy`)
- `--reason <reason>` — provide an access reason (if required by template)
</Tab>
</Tabs>