ssh/scp command too slow to connect compared to putty. What could be causing it?

4

1

I use Putty to connect to ssh server when on windows, and the ssh command when on linux. I've recently noticed, that Putty establishes the connection much more quickly compared to the ssh and scp commands on linux. While It only takes a second or less to login via putty, it takes about 20 secons to get to the password prompt in ssh when connection to the same server from the same network.

I'm using the default settings in Putty. I also don't use any special arguments with the ssh command (just the port, username, and server name). Is there any way I can make ssh connect as quickly as Putty does?

Anthony

Posted 2014-02-01T16:17:09.630

Reputation: 245

Answers

2

This is what i came up with, by guessing... It is not sure it'll work:

ssh -4 -C -o PreferredAuthentications=password   user@host.domain.com

Where:

  • -4 force IPv4, disable IPv6 tries.
  • -C enable connection compression.
  • -o PreferredAuthentications=password tries nothing else but password auth.

I think that just the first or last option should do the trick. The -C have little effect in your case.

You may want to setup a authentication by rsa key. I've written a how-to to Harden the SSH access security on Debian. It may be of help to you.

Biapy

Posted 2014-02-01T16:17:09.630

Reputation: 959

WOW! major improvement, as you said, -k and -C have negligible effect since it's just the initial handshake that's taking forever. Though, -C could help with scp. -k I don't really understand. Anyway, thanks a lot! – Anthony – 2014-02-01T17:43:44.363

you're right, the -k is useless. i've edited my answer. – Biapy – 2014-02-01T18:27:47.310

By the way I'm also adding the -2 switch whitch stands for ssh 2, to avoid negociation overhead, though I think it's useless too because I probably starts with version 2 and falls back to 1 if not supported, but it costs only on keystroke to add that swith ( -42 instead of just 4). – Anthony – 2014-02-01T18:35:04.753