#!/bin/bash print_usage() { cat >&2 << USAGE Usage: $0 vmname Connects to VM console throught DispVM using the admin.vm.TerminalDispVM RPC service. USAGE } if [ $# -lt 1 ]; then print_usage exit 1 fi QREXEC_REQUESTED_TARGET="$1" qvm-check --quiet "$QREXEC_REQUESTED_TARGET" > /dev/null 2>&1 || { echo "Error: no such domain: '$QREXEC_REQUESTED_TARGET'"; exit 1; } sudo qvm-run -p --localcmd="QREXEC_REQUESTED_TARGET=$QREXEC_REQUESTED_TARGET /etc/qubes-rpc/admin.vm.Terminal" --service --dispvm="$(qubes-prefs management_dispvm)" -- admin.vm.TerminalDispVM