/kamal-skills:sshfrom kamal-skills
Configure how Kamal connects to servers over SSH and tune SSHKit connection handling. Use when the user sets the SSH `user` or `port`, authenticate with specific `keys`/`key_data`, force `keys_only`, control agent forwarding (`forward_agent`), load an OpenSSH `config` file, connect through a jump/bastion host with `proxy` or `proxy_command`, debug connection problems with `log_level: debug`, or tune concurrency and pooling (`max_concurrent_starts`, `pool_idle_timeout`, `dns_retries`) when deploying to many hosts. Also use when they say "kamal can't connect to my server," "permission denied (publickey)," "deploy as a non-root user," "kamal through a bastion/jump host," "SSH timeouts deploying to lots of servers," or "change the SSH port for kamal." These map to the `ssh:` and `sshkit:` blocks in `config/deploy.yml`. For first-time project setup, see setup. For defining the hosts and roles you connect to, see servers.
Ships in kamal-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
You are an expert in deploying applications with Kamal. Your goal here is to get Kamal connecting reliably to the user's servers over SSH, and — when they deploy to many hosts — to tune the SSHKit connection layer so deploys don't stall or fail.
Kamal uses SSH to connect and run commands on your hosts. By default it connects to the root user on port 22, authenticated by your SSH key. Two configuration blocks control this, both in config/deploy.yml:
ssh: — who you connect as, on what port, with which keys, and through which proxy.sshkit: — how the underlying SSHKit toolkit manages connection concurrency and pooling.Read what the user already has before asking questions:
config/deploy.yml — check for existing ssh: and sshkit: blocks, and look at the servers: list to see how many hosts you're connecting to..kamal/secrets — if you'll reference a private key by secret name (key_data), confirm the secret exists here.~/.ssh/config — existing host aliases, users, ports, or ProxyJump entries may already define how to reach these hosts.Then run kamal config to print the resolved configuration, including the :ssh_options: Kamal will actually use (user, port, log level). This is the fastest way to confirm what's in effect before changing anything.
Defaults: root user, port 22. When you run kamal setup, Kamal connects to each server over SSH (root by default), installs Docker if missing, and proceeds with the deploy. Root access over SSH is what lets the initial Docker install happen.
If you connect as a non-root user, you may need to bootstrap each server manually first so the user can run Docker. On Ubuntu:
sudo apt update
sudo apt upgrade -y
sudo apt install -y docker.io curl git
sudo usermod -a -G docker app
All SSH settings live under the ssh: key. Set the login user and port if they differ from the defaults:
ssh:
user: app
port: "2222"
user defaults to root.port defaults to 22.If you changed the user to a non-root account, make sure you bootstrapped Docker access for it (see above).
By default Kamal authenticates with the keys your ssh-agent offers and your OpenSSH config. To be explicit, point Kamal at specific keys.
keys is an array of private-key file names used for public-key and host-based authentication:
ssh:
keys: [ "~/.ssh/id.pem" ]
key_data is an array where each element is a secret name (resolved from .kamal/secrets):
ssh:
key_data:
- SSH_PRIVATE_KEY
This is the preferred way to inject a key in CI. You can also pass a raw PEM string here, but that is deprecated.
If your ssh-agent offers many identities (a common cause of Too many authentication failures), set keys_only: true so Kamal uses only the keys from keys and key_data:
ssh:
keys_only: true
keys: [ "~/.ssh/id.pem" ]
config controls whether the default OpenSSH config files (~/.ssh/config, /etc/ssh_config) are loaded. It defaults to true. Set it to false to ignore them, or to a path (or array of paths) to load specific files.forward_agent controls whether your local SSH agent is forwarded to the remote host. It defaults to true (SSHKit's default).ssh:
config: [ "~/.ssh/myconfig" ]
forward_agent: false
See references/ssh-options.md for the full ssh: key reference.
If your servers aren't reachable directly, route the connection through a proxy (bastion/jump) host.
proxy takes the form <host> or <user>@<host>:
ssh:
proxy: root@proxy-host
For older versions of SSH that need an explicit command, use proxy_command:
ssh:
proxy_command: "ssh -W %h:%p user@proxy"
Set forward_agent: false when connecting through a jump host or tunnel that does not support agent forwarding — for example, Cloudflare Access for Infrastructure with SSH:
ssh:
proxy: bastion.example.com
forward_agent: false
When a deploy fails with an SSH error (permission denied, timeouts, host key problems), raise the log level. log_level defaults to fatal; set it to debug to see the underlying SSH negotiation:
ssh:
log_level: debug
Use this together with kamal config (to confirm the resolved user/port/keys) to pinpoint whether the problem is authentication, the wrong port, or the proxy.
The SSHKit defaults are sufficient for most deployments. Reach for the sshkit: block when you deploy to a large number of hosts and see connection storms, DNS hiccups, or reconnection churn.
sshkit:
max_concurrent_starts: 10
pool_idle_timeout: 300
dns_retries: 3
| Key | Default | What it does |
|---|---|---|
max_concurrent_starts | 30 | Caps how many SSH connections Kamal opens at once. Lower it when opening many connections concurrently causes problems on large fleets. |
pool_idle_timeout | 900 (seconds) | How long idle connections are kept. Kamal keeps a long idle timeout to avoid re-connection storms after idle periods like image builds or waiting for CI. |
dns_retries | 3 | Retries after the initial DNS attempt. Some resolvers (mDNSResponder, systemd-resolved, Tailscale) drop lookups during bursts of concurrent SSH starts; Kamal retries automatically. Set to 0 to disable. |
For more on when and how to adjust these, see references/sshkit-options.md.
After editing, confirm the result:
kamal config
The output includes a :ssh_options: section (user, port, log level) and the :sshkit: settings Kamal resolved from config/deploy.yml. Check these match what you intended before running a deploy.
If you use destinations, ssh: and sshkit: can be set per destination: the matching config/deploy.<destination>.yml is merged over the base config (e.g. kamal config -d staging).
A non-root deploy through a bastion, with an explicit key and tuned concurrency:
ssh:
user: app
port: "2222"
proxy: [email protected]
keys: [ "~/.ssh/deploy.pem" ]
keys_only: true
forward_agent: false
sshkit:
max_concurrent_starts: 10
kamal init, and config/deploy.yml basics before you tune SSH.servers:) that these SSH settings connect to.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub donnfelker/kamal-skills --plugin kamal-skills25 skills in this plugin
/accessoriesRun and manage accessory services — databases, Redis, search, and other long-lived dependencies your app needs — through Kamal's `accessories:` configuration and the `kamal accessory` command. Use this when the user says things like "add a MySQL/Postgres/Redis accessory," "run a database with Kamal," "kamal accessory boot," "set up a sidecar/companion service," "my app needs a cache or search container," "persist accessory data with volumes," or "reboot/restart/remove an accessory." Covers defining the accessory (image, host/hosts/role/roles/tag/tags, port, env, files, directories, volumes, network, options, registry, proxy) and operating it with boot, reboot, restart, start, stop, details, logs, exec, and remove. For passing configuration and credentials into accessories, see env and secrets. For scheduled jobs, see cron./aliasesDefine custom command aliases under the top-level `aliases` key in `config/deploy.yml` so a long, repeated `kamal` invocation becomes a single `kamal <name>`. Use it when the user says "add a Kamal alias," "shortcut kamal app exec," "make `kamal console` open a Rails console," "create a one-liner to deploy staging," "I keep retyping the same kamal command," or asks about the `aliases` config key, alias naming rules, or a `deploy -d staging` shortcut. Covers how an alias expands into a `kamal` subcommand, the lowercase letters/numbers/dashes/underscores naming rule, and the documented examples `console: app exec -i --reuse "bin/rails console"`, `uname: app exec -p -q -r web "uname -a"`, and `staging_deploy: deploy -d staging`. For the rest of `config/deploy.yml` and DRYing it up with YAML anchors, see config. For the underlying app exec / console / logs commands the aliases wrap, see app.Other plugins' skills for the same job