Syntax
Options
Arguments
Usage
Run a command on the box
With aCOMMAND, lager ssh behaves like ssh user@host <command>. It runs
the command on the box, streams its output back, and exits with the command’s
exit code. There is no interactive shell. This is handy for scripting and
one-off checks.
lager ssh with a COMMAND does not allocate a terminal. A remote sudo
command therefore works only when the box user has a passwordless grant for it.
Otherwise, run it in an interactive session.
Use
-- to separate lager’s options from the remote command whenever the
command contains its own dashed flags, so they aren’t parsed as lager
options. The remote command’s exit code is propagated as lager ssh’s exit
code, so it composes cleanly in scripts.How It Works
The command:- Resolves the Lager Box name to IP address
- Looks up the SSH username (default:
lagerdata) - Chooses the SSH identities to offer
- Opens an interactive SSH session, or runs the command
~/.ssh/lager_box exists, lager ssh passes it with -i. The -i flag
replaces the default identity list of SSH instead of adding to it. So
lager ssh also names each of your own default keys that exists, after
lager_box. Those keys are id_rsa, id_ecdsa, id_ecdsa_sk, id_ed25519
and id_ed25519_sk. Identities from ~/.ssh/config and agent keys stay on
offer. With no lager_box key, lager ssh passes no -i at all.
Username Resolution
SSH usernames are resolved in order:- Username stored with box configuration (
lager boxes add --user) - Default username:
lagerdata
lager ssh looks up the stored username by box name. For an IP address in
--box, or for the default box, it uses the username of the saved box with that
IP address.
To use a different username for a Lager Box:
SSH Key Setup
For passwordless access, install the Lager SSH key on the box. The command asks for the box password once:ssh-copy-id also works, because
lager ssh offers your default keys too. See
SSH Setup.
Examples
Common Tasks via SSH
Each of these can be run as a one-liner withlager ssh --box <box> -- <command>,
or interactively after lager ssh --box <box>.
Check Container Status
View Lager Box Version
Check Disk Space
View Firewall Status
sudo asks for a password on most boxes, so open an interactive session first:
Notes
- With no
COMMAND, opens a fully interactive shell session (exit withexitor Ctrl+D) - With a
COMMAND, runs it on the box and exits with the command’s exit code - The session runs as a child process so Lager’s cleanup hooks still fire
- Default Lager Box is used if
--boxnot specified

