tursa-energy-efficiency/2-racks/size-C0/remote-sudo.sh
2022-09-07 17:31:28 +01:00

15 lines
313 B
Bash
Executable File

#!/usr/bin/env bash
# shellcheck disable=SC2029
set -euo pipefail
if (( $# != 2 )); then
echo "usage: $(basename "$0") <hostname> <command>" 1>&2
exit 1
fi
host=$1
command=$2
pass='xxxxxxxxxxx' # redacted
sshpass -f ${pass} ssh -oStrictHostKeyChecking=no "${host}" "sudo -S -p '' ${command} < ${pass}"