Parallel Works

pw ssh

pw ssh

Initiate an SSH connection to a resource

Synopsis

The pw ssh command initiates an SSH connection to a specific compute resource. The resource has to be running, and you must have SSH access to it.

Resource names can be specified in the following formats:

  • pw://username/name - full format with explicit username
  • pw://name - managed cluster by name in your organization
  • name - short format where username defaults to your username
  • workspace - your user workspace
  • worker/id - compute node running one of your workers, as listed by pw workers ls

The first connection generates an SSH key pair at ~/.ssh/pwcli and registers the public key with your platform account; later connections (and the ProxyCommand examples below) reuse it.

pw ssh <resource> [command] [flags]

Examples

  pw ssh my-resource
  
  # Interactively connect to a resource owned by another user
  pw ssh pw://Jake.Thayne/my-resource
  
  # Interactively connect to a managed cluster in your organization
  pw ssh acme-hpc
  pw ssh pw://acme-hpc
  
  # Interactively connect to your user workspace
  pw ssh workspace
  
  # Interactively connect to the compute node running one of your workers
  pw ssh worker/60c72b2f9b1e8d001c8e4f3a
  
  # Run the "hostname" command on a resource and exit
  pw ssh my-resource hostname
  
  # Run the "hostname" command on your user workspace and exit
  pw ssh workspace hostname
  
  # Connect to a node via a pw:// jump host (username defaults to resource username)
  pw ssh -J pw://Jake.Thayne/my-cluster 10.0.1.5
  
  # Connect to a node via a jump host with an explicit username
  pw ssh -J pw://Jake.Thayne/my-cluster alice@10.0.1.5
  
  # Write an OpenSSH config entry once, then use plain ssh/scp/sshfs
  pw ssh configure my-resource
  ssh my-resource
  
  # Run as a ProxyCommand for SSH
  ssh -i ~/.ssh/pwcli -o ProxyCommand="pw ssh --proxy-command %h" user@my-resource
  ssh -i ~/.ssh/pwcli -o ProxyCommand="pw ssh --proxy-command %h" user@pw://Jake.Thayne/my-resource
  ssh -i ~/.ssh/pwcli -o ProxyCommand="pw ssh --proxy-command %h" user@workspace
  
  # Run as a ProxyCommand for SSH, with port forward
  ssh -i ~/.ssh/pwcli -L 8080:localhost:80 -o ProxyCommand="pw ssh --proxy-command %h" user@my-resource
  ssh -i ~/.ssh/pwcli -R 80:localhost:8000 -o ProxyCommand="pw ssh --proxy-command %h" user@workspace
  
  # Run as a ProxyCommand for SCP
  scp -i ~/.ssh/pwcli -o ProxyCommand="pw ssh --proxy-command %h" file.txt user@my-resource:/home/user/file.txt
  scp -i ~/.ssh/pwcli -o ProxyCommand="pw ssh --proxy-command %h" file.txt user@workspace:/home/user/file.txt

Options

  -h, --help                 help for ssh
  -J, --jump string          Connect to the target via a pw:// jump host (similar to ssh -J)
      --keepalive int        Interval in seconds between keepalive messages; an unresponsive connection is closed (0 to disable) (default 30)
  -L, --local stringArray    Forward local [bind_address:]port to remote host:hostport
      --proxy-command        Run as a proxy command for SSH or SCP
  -R, --remote stringArray   Forward remote [bind_address:]port to local host:hostport
  -X, --x11                  Enable X11 forwarding

Options inherited from parent commands

      --context string         The context to use. Overrides PW_CONTEXT environment variable and current context from config.
      --platform-host string   The Parallel Works ACTIVATE platform host to use. Overrides PW_PLATFORM_HOST environment variable and the current context's server.
  -v, --verbose                Enable verbose logging

SEE ALSO

  • pw - The Parallel Works ACTIVATE CLI
  • pw ssh configure - Write an OpenSSH config entry that connects through the platform