7

When I do (I've tried various ways):

ssh -v -C -o CompressionLevel=9 user@ip
ssh -v -C -o 'CompressionLevel=9' user@ip
ssh -v -o 'Compression=yes' -o 'CompressionLevel=9' user@ip
ssh -v -o 'CompressionLevel=9' -o 'Compression=yes' user@ip
ssh -v -C -o 'CompressionLevel 9' user@ip
ssh -v -o 'Compression yes' -o 'CompressionLevel 9' user@ip
ssh -v -o 'CompressionLevel 9' -o 'Compression yes' user@ip

I enabled -v, so I can see connection details and no matter, what I tried, I can't get compression level more than 6, as it shows in verbose output:

debug1: Enabling compression at level 6.

I don't need to set CompressionLevel in ssh_config, I need to do it with cli.

I've found some info, that the option CompressionLevel works only for ssh version 1, but not 2.

How to set the maximum compression level for ssh version 2 protocol?

Castaglia
  • 3,239
  • 3
  • 19
  • 40
igoryonya
  • 185
  • 1
  • 2
  • 14

3 Answers3

9

You can't. As the man page clearly states, CompressionLevel is an option only for protocol version 1.

See this for a possible alternative, but unless you are on a real slow or expensive connection, just using the default is a much better approach.

Sven
  • 97,248
  • 13
  • 177
  • 225
7

You can't, ssh protocol V2 does not allow for negotiation of compression levels. It is fixed at a point that is a good balance between speed & compression.

user9517
  • 114,104
  • 20
  • 206
  • 289
-1

OK, I've came up to a solution:
First, I create an encrypted, noncompressed ssh v2 tunnel:

ssh -fN -L frwrd_port:frwrd_ip:22 user@ip

Then, I use ssh v1 with some fast cypher, like arcfour and maximum compression enabled over the tunnel, created in the 1st step:

ssh -1 -c arcfour -C -o "CompressionLevel=9" -p frwrd_port user@frwrd_ip
igoryonya
  • 185
  • 1
  • 2
  • 14
  • 2
    This only works if the remote end supports protocol 1, which is no longer true as of recent versions of OpenSSH. You should not rely on this for a long term solution, or even a medium term solution. – Michael Hampton Feb 26 '17 at 01:29
  • Yes, I've forgot to mention, that version 1 needs to be enabled in sshd_conf on hosts, that require to be tunneled to. – igoryonya Feb 26 '17 at 04:20
  • You don't want to enable SSH v1 at the remote host, because it is obsolete and might have security issues. Of course if you can restrict SSH v1 so that only tunneled connections can use it, then is is secure. – Tero Kilkanen Feb 27 '17 at 12:28