allow only passwordless SSH

This commit is contained in:
Ignacio Nunez 2018-06-14 12:45:03 +02:00
parent 36c05dc9e8
commit 96d499006a

@ -96,10 +96,10 @@ DST="${@: -1}"
[[ "$DST" =~ : ]] && {
NET="$( sed 's|:.*||' <<<"$DST" )"
DST="$( sed 's|.*:||' <<<"$DST" )"
SSH=( ssh -o ServerAliveInterval=5 -o ConnectTimeout=1 "$NET" )
SSH=( ssh -o ServerAliveInterval=5 -o ConnectTimeout=1 -o BatchMode=yes "$NET" )
}
[[ "$SSH" != "" ]] && DST_CMD=( ${SSH[@]} ) || DST_CMD=( eval )
${DST_CMD[@]} true &>/dev/null || { echo "SSH access error to $NET"; exit 1; }
${DST_CMD[@]} true &>/dev/null || { echo "SSH access error to $NET. Do you have passwordless login setup?"; exit 1; }
#----------------------------------------------------------------------------------------------------------