From 66d7e5f93ed0f3139ba4a6635bf355a4c0052a04 Mon Sep 17 00:00:00 2001 From: Arthur Hanson Rasmusson Date: Sun, 11 Oct 2026 20:42:45 -0400 Subject: 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_*. --- scripts/ssh_guest.sh | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100755 scripts/ssh_guest.sh 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" "$@" -- cgit v1.2.3