diff options
| author | Arthur Hanson Rasmusson <arthur@vgpu.io> | 2026-10-11 20:42:45 -0400 |
|---|---|---|
| committer | Arthur Hanson Rasmusson <arthur@vgpu.io> | 2026-10-11 20:42:45 -0400 |
| commit | f5131cd6a61f22e059550326a8f28bdd6bd360cd (patch) | |
| tree | eedd247fdea1707f27c93b42dc3396630dd1fbb1 | |
| parent | 7792359c090a0b0a7b144a9b32952a5595e06a0b (diff) | |
| download | open-iov-f5131cd6a61f22e059550326a8f28bdd6bd360cd.tar.gz open-iov-f5131cd6a61f22e059550326a8f28bdd6bd360cd.zip | |
scripts: add ssh_guest.sh - reliable SSH into the running vGPU guest
Password auth with key auth disabled outright: the host's id_rsa is
passphrase-protected and a stale copy of its public key in the guest's
authorized_keys made plain ssh hang on the passphrase prompt (the
reported 'sshpass hangs'). Wrapper defaults to 127.0.0.1:2222
ubuntu/ubuntu, overridable via VGPU_GUEST_*.
| -rwxr-xr-x | scripts/ssh_guest.sh | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/scripts/ssh_guest.sh b/scripts/ssh_guest.sh new file mode 100755 index 0000000..b49a992 --- /dev/null +++ b/scripts/ssh_guest.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# ssh_guest.sh - SSH into the running vGPU guest. +# +# Usage: +# scripts/ssh_guest.sh # interactive shell +# scripts/ssh_guest.sh "nvidia-smi -L" # run one command +# +# Why the explicit options: the host's ~/.ssh/id_rsa is passphrase-protected +# and the guest image once carried its public key in authorized_keys; ssh +# offered the key, the guest accepted it and the session hung on the +# passphrase prompt (sshpass only answers password prompts). The stale key +# was removed from the guest; this wrapper also disables key auth outright so +# the session can never hang that way again. Password auth is used. +# +# Overridable: VGPU_GUEST_HOST, VGPU_GUEST_PORT, VGPU_GUEST_USER, +# VGPU_GUEST_PASS (defaults 127.0.0.1:2222 ubuntu/ubuntu). +set -u +HOST="${VGPU_GUEST_HOST:-127.0.0.1}" +PORT="${VGPU_GUEST_PORT:-2222}" +USER="${VGPU_GUEST_USER:-ubuntu}" +PASS="${VGPU_GUEST_PASS:-ubuntu}" + +command -v sshpass >/dev/null || { echo "sshpass not installed" >&2; exit 1; } + +exec sshpass -p "$PASS" ssh \ + -p "$PORT" \ + -o StrictHostKeyChecking=no \ + -o UserKnownHostsFile=/dev/null \ + -o PubkeyAuthentication=no \ + -o PreferredAuthentications=password \ + -o ConnectTimeout=15 \ + -o ServerAliveInterval=15 \ + -o ServerAliveCountMax=4 \ + "$USER@$HOST" "$@" |
