Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

-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 foo@domain.com -vvvv is more reliable than ssh foo@domain.com. 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?

share|improve this question
add comment

2 Answers

up vote 6 down vote accepted

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?

share|improve this answer
add comment

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.

share|improve this answer
    
That is exactly what I presume but this behavior I'm experiencing says otherwise. –  meder Aug 11 '10 at 19:58
    
Unless you -v in the first place, you'll rarely know the specific details of the problem :). –  VxJasonxV Aug 12 '10 at 17:54
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.