2026-08-11 11:22:55 -04:00
---
# Code generated by make gen. DO NOT EDIT.
2026-09-28 15:44:10 -04:00
title : "`coder ssh`"
2026-10-20 18:51:44 -04:00
description : Start a shell into a workspace or run a command.
2026-08-11 11:22:55 -04:00
---
2023-03-23 17:42:20 -05:00
<!-- DO NOT EDIT | GENERATED CONTENT -->
2025-05-16 10:09:46 -04:00
Start a shell into a workspace or run a command
2023-03-23 17:42:20 -05:00
## Usage
```console
2025-05-16 10:09:46 -04:00
coder ssh [flags] <workspace> [command]
2023-03-23 17:42:20 -05:00
```
2025-05-14 15:42:44 -04:00
## Description
```console
This command does not have full parity with the standard SSH command. For users who need the full functionality of SSH, create an ssh configuration with `coder config-ssh`.
2025-05-16 10:09:46 -04:00
- Use `--` to separate and pass flags directly to the command executed via SSH.:
$ coder ssh <workspace> -- ls -la
2025-05-14 15:42:44 -04:00
```
2023-03-23 17:42:20 -05:00
## Options
2024-03-15 11:24:38 -05:00
### --stdio
2023-12-08 10:01:13 -06:00
2026-10-21 10:58:04 -07:00
| Property | Value |
2025-01-03 18:12:59 +05:00
|-------------|-------------------------------|
2024-03-15 11:24:38 -05:00
| Type | <code>bool</code> |
| Environment | <code>$CODER_SSH_STDIO</code> |
2023-12-08 10:01:13 -06:00
2024-03-15 11:24:38 -05:00
Specifies whether to emit SSH output over stdin/stdout.
2023-12-08 10:01:13 -06:00
2026-05-01 15:02:05 +02:00
### -t, --tty
2026-10-21 10:58:04 -07:00
| Property | Value |
2026-05-01 15:02:05 +02:00
|-------------|-----------------------------|
| Type | <code>bool</code> |
| Environment | <code>$CODER_SSH_TTY</code> |
Request a pseudo-terminal for the SSH session. Interactive shell sessions request one by default; command sessions do not unless this flag is set.
2025-01-13 17:07:21 -08:00
### --ssh-host-prefix
2026-10-21 10:58:04 -07:00
| Property | Value |
2025-01-13 17:07:21 -08:00
|-------------|-----------------------------------------|
| Type | <code>string</code> |
| Environment | <code>$CODER_SSH_SSH_HOST_PREFIX</code> |
Strip this prefix from the provided hostname to determine the workspace name. This is useful when used as part of an OpenSSH proxy command.
2025-04-07 21:33:33 +04:00
### --hostname-suffix
2026-10-21 10:58:04 -07:00
| Property | Value |
2025-04-07 21:33:33 +04:00
|-------------|-----------------------------------------|
| Type | <code>string</code> |
| Environment | <code>$CODER_SSH_HOSTNAME_SUFFIX</code> |
Strip this suffix from the provided hostname to determine the workspace name. This is useful when used as part of an OpenSSH proxy command. The suffix must be specified without a leading . character.
2023-03-23 17:42:20 -05:00
### -A, --forward-agent
2026-10-21 10:58:04 -07:00
| Property | Value |
2025-01-03 18:12:59 +05:00
|-------------|---------------------------------------|
2023-03-23 17:42:20 -05:00
| Type | <code>bool</code> |
| Environment | <code>$CODER_SSH_FORWARD_AGENT</code> |
Specifies whether to forward the SSH agent specified in $SSH_AUTH_SOCK.
### -G, --forward-gpg
2026-10-21 10:58:04 -07:00
| Property | Value |
2025-01-03 18:12:59 +05:00
|-------------|-------------------------------------|
2023-03-23 17:42:20 -05:00
| Type | <code>bool</code> |
| Environment | <code>$CODER_SSH_FORWARD_GPG</code> |
Specifies whether to forward the GPG agent. Unsupported on Windows workspaces, but supports all clients. Requires gnupg (gpg, gpgconf) on both the client and workspace. The GPG agent must already be running locally and will not be started for you. If a GPG agent is already running in the workspace, it will be attempted to be killed.
### --identity-agent
2026-10-21 10:58:04 -07:00
| Property | Value |
2025-01-03 18:12:59 +05:00
|-------------|----------------------------------------|
2023-03-23 17:42:20 -05:00
| Type | <code>string</code> |
| Environment | <code>$CODER_SSH_IDENTITY_AGENT</code> |
Specifies which identity agent to use (overrides $SSH_AUTH_SOCK), forward agent must also be enabled.
2024-03-15 11:24:38 -05:00
### --workspace-poll-interval
2023-05-25 09:07:39 +04:00
2026-10-21 10:58:04 -07:00
| Property | Value |
2025-01-03 18:12:59 +05:00
|-------------|---------------------------------------------|
2024-03-15 11:24:38 -05:00
| Type | <code>duration</code> |
| Environment | <code>$CODER_WORKSPACE_POLL_INTERVAL</code> |
| Default | <code>1m</code> |
2023-05-25 09:07:39 +04:00
2024-03-15 11:24:38 -05:00
Specifies how often to poll for workspace automated shutdown.
2023-03-23 17:42:20 -05:00
2023-06-08 16:52:44 +03:00
### --wait
2026-10-21 10:58:04 -07:00
| Property | Value |
2025-01-03 18:12:59 +05:00
|-------------|------------------------------|
2024-08-20 14:47:46 +10:00
| Type | <code>yes\|no\|auto</code> |
| Environment | <code>$CODER_SSH_WAIT</code> |
| Default | <code>auto</code> |
2023-06-08 16:52:44 +03:00
Specifies whether or not to wait for the startup script to finish executing. Auto means that the agent startup script behavior configured in the workspace template is used.
2024-03-15 11:24:38 -05:00
### --no-wait
2023-03-23 17:42:20 -05:00
2026-10-21 10:58:04 -07:00
| Property | Value |
2025-01-03 18:12:59 +05:00
|-------------|---------------------------------|
2024-03-15 11:24:38 -05:00
| Type | <code>bool</code> |
| Environment | <code>$CODER_SSH_NO_WAIT</code> |
2023-03-23 17:42:20 -05:00
2024-03-15 11:24:38 -05:00
Enter workspace immediately after the agent has connected. This is the default if the template has configured the agent startup script behavior as non-blocking.
### -l, --log-dir
2026-10-21 10:58:04 -07:00
| Property | Value |
2025-01-03 18:12:59 +05:00
|-------------|---------------------------------|
2024-03-15 11:24:38 -05:00
| Type | <code>string</code> |
| Environment | <code>$CODER_SSH_LOG_DIR</code> |
Specify the directory containing SSH diagnostic log files.
### -R, --remote-forward
2026-10-21 10:58:04 -07:00
| Property | Value |
2025-01-03 18:12:59 +05:00
|-------------|----------------------------------------|
2024-03-15 11:24:38 -05:00
| Type | <code>string-array</code> |
| Environment | <code>$CODER_SSH_REMOTE_FORWARD</code> |
Enable remote port forwarding (remote_port:local_address:local_port).
2024-04-22 03:13:48 -07:00
### -e, --env
2026-10-21 10:58:04 -07:00
| Property | Value |
2025-01-03 18:12:59 +05:00
|-------------|-----------------------------|
2024-04-22 03:13:48 -07:00
| Type | <code>string-array</code> |
| Environment | <code>$CODER_SSH_ENV</code> |
Set environment variable(s) for session (key1=value1,key2=value2,...).
2025-01-13 16:29:31 -08:00
### --network-info-dir
2026-10-21 10:58:04 -07:00
| Property | Value |
|----------|---------------------|
| Type | <code>string</code> |
2025-01-13 16:29:31 -08:00
Specifies a directory to write network information periodically.
### --network-info-interval
2026-10-21 10:58:04 -07:00
| Property | Value |
|----------|-----------------------|
| Type | <code>duration</code> |
| Default | <code>5s</code> |
2025-01-13 16:29:31 -08:00
Specifies the interval to update network information.
2024-03-15 11:24:38 -05:00
### --disable-autostart
2026-10-21 10:58:04 -07:00
| Property | Value |
2025-01-03 18:12:59 +05:00
|-------------|-------------------------------------------|
2024-03-15 11:24:38 -05:00
| Type | <code>bool</code> |
| Environment | <code>$CODER_SSH_DISABLE_AUTOSTART</code> |
| Default | <code>false</code> |
Disable starting the workspace automatically when connecting via SSH.