How-to: get the SSH connection line and runtime ports for a running pod
This is a worked task for reading the SSH address of a running pod. The reference
page (rp doc ssh info) documents the individual flags; this page shows the
call composed into a single workflow.
Goal: get the ssh connection line and the runtime ports for a pod that is
currently running, so you can reach it over SSH.
Steps
- Get the raw pod id.
rp ssh infotakes the id verbatim — it does not resolve pod names — so read it fromrp pod listfirst:
$ rp pod list
The ID column (for example rp_abc123) is the value to pass in step 2.
- Print the connection line. Pass that raw id to
rp ssh info; it reads the pod over the REST v2 control plane and prints thesshline:
$ rp ssh info rp_abc123
ssh root@57.1.2.3 -p 22981
The login user defaults to root (Runpod official images run as root).
- Set the user for a non-root image. Images that start as a non-root user need
--userto match, otherwise the printed line fails with a permission error:
$ rp ssh info rp_abc123 --user ubuntu
ssh ubuntu@57.1.2.3 -p 22981
The --user value is not validated against the pod; pass the user the image
actually starts as.
- See the full pod record.
--jsonprints the entire pod object the line was derived from — useful for inspecting every runtime port:
$ rp ssh info rp_abc123 --json
Notes
- The connection line is built from the first runtime port whose
typeissshortcp, in the order the API returns them. It does not guarantee anssh-labelled port is preferred over atcpone — whichever appears first inruntime.portsis used. - A stopped pod has no runtime and prints
pod has no runtime (stopped?)rather than failing; start the pod and ask again. - A running pod that exposes no
sshortcpport prints its available runtime ports instead of a connection line. - Registering a key with
rp ssh-key addis what makes the address reachable;rp ssh infoonly reports it. - The call rides
GET /v2/pods/{id}on the control plane (api.runpod.io/v2).