Is there an SSH option (similar to -o ConnectTimeout=$seconds
) that limits the time that it spends waiting at a password:
prompt?
Note, I do use keypairs for passwordless ssh, but I still wind up seeing a password:
prompt several times a week,
because I have bash functions running in a background window that reconnect my SSH tunnels whenever they drop (as I wander between WiFi networks and close the MacBook lid randomly). So sometimes SSH negotiation can get into the "password:" state, then it stays there until I manually intervene with ^C
or killall ssh
...
dtunnel-home () {
while true ; do
title "XXX-TTT-..."
wait-for-host.sh "$g" ## sleep until ping-able.
time (
set -x
ssh -o ConnectTimeout=10 \
-Y -L 5920:$t:5900 -L ... \
$g_user@$g
) ; date "+%Y-%m-%d_%H-%M-%S"
done
}