Skip to content

spawn connect <linux> -- <cmd> silently drops the command and opens an interactive SSM session (no public IP / --session-manager / key-injection fallback) #1306

Closed

Description

@scttfrdmn

Found while doing #1296 (PR #1303).

On Linux, spawn connect <i> -- <cmd> ignores <cmd> and opens an interactive aws ssm start-session whenever the SSM path is taken. It is taken when:

  • --session-manager is passed,
  • the instance has no public IP, or
  • the key-injection fallback fails.

In cmd/connect.go, runConnect calls connectViaSessionManager(instance.InstanceID, instance.Region), which takes no command argument. args[1:] is only read later, on the SSH path (buildRemoteCommand). A scripted one-shot call therefore hangs on stdin instead of running the command.

Windows already runs one-shot commands over SSM RunCommand (connectWindows → client.RunPowerShell). The Linux equivalent would use client.RunShellScript. It needs a decision on the user, since RunShellScript runs as root and SSH runs as the spawn:local-username user (sudo -u?), and on exit-code and output propagation.

#1303 guards only the new case, where the security groups admit no SSH: a one-shot there fails at once with the reason. The three existing cases above still open an interactive session. This is a code trace only, not reproduced live.

Activity

  1. added this to the v0.146.0 milestone on Oct 25, 2026
  2. added a commit that references this issue on Oct 26, 2026
    e9c44e7
  3. added a commit that references this issue on Oct 26, 2026
    e6bac38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions