15 lines
313 B
Bash
Executable File
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}"
|