-v
which has a max limit of 3-4 controls the verbosity for the ssh
command.
I'm behind a proxy and I have ssh setup to use a proxy, so this could be the case but I've noticed that
ssh [email protected] -vvvv
is more reliable than ssh [email protected]
. Call me crazy, but if I don't specify the verbosity sometimes it just doesn't connect. If I do specify the verbosity, it will be more informative and connect.
Is there any explanation for this behaviour? And for me this is pretty consistent behaviour. Does the verbosity somehow change a variable in the way the ssh connects and returns data such that it forces it to work?
Because
ssh -vvv
spends a lot of time printing messages and that gives the other side more time to respond to packets... No, I don't see how this could make any actual difference.I suspect an observation bias. I conjecture that the second
ssh
attempt has a higher probability of success than the first (and the-vvv
is just a coincidence, because you tend to use-vvv
the second time but not the first time).If the first
ssh
fails due to a short-duration (no more than a couple of seconds) problem on a router/firewall/proxy somewhere, and the probability an ssh connection fails is p, then the probability that the second attempt fails assuming you've made a second attempt is p, so the probability that the second attempt is made and fails is p².If the first
ssh
fails due to a DNS lookup failure (lookup of the server by the client, lookup of your machine by the proxy, ...), the failure may be due to a too short timeout. By the time of your second attempt the data is ready in some cache and arrives immediately.If the first
ssh
fails because something (the server, or an intermediate firewall, perhaps your proxy) had to load some data from disk or make some calculation, and something else timed out while the data was still being loaded or calculated, the second attempt finds the data already in cache.@meder, is my parenthesized conjecture in paragraph 2 correct?
The only difference a -v or any number of -v's should make is the verbosity level returned to you. Connection debug, X Forwarding stats, etc.
It's not impossible to think that numerous -v's could keep alive a shaky connection, or a connection with an appliance that is very keen towards killing idle connections, but the initial connection should be no different as far as the actual SSH communication on-the-wire is concerned.