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?

  • Have you ever seen an appreciable difference in throughput with 6 vs 9? – Jason Martin Feb 26 '17 at 2:58
  • @JasonMartin i wrote too much just now. anyway, yes the difference is not always irrelevant – Florian Heigl May 27 '18 at 23:55

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.


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.


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
  • 1
    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 1: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 4: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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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