8

I want max compression on my ssh tunnel cos I'm on a dialup line ;)

At the man page can one can read:

CompressionLevel .....The meaning of the values is the same as in gzip(1). Note that this option applies to protocol version 1 only.

What if I want max compression rate and while using ssh version 2?

How know the protocol version I'm using?

2 Answers2

4

Depending on your use case, you might want to utilize pipes in order to achieve higher compression levels for certain streams.

ssh ${SSH_USER}@${SSH_HOST} "
    echo 'string to be compressed' | gzip -9
" | zcat | echo -

The above example compresses the string/stream on the remote side (gzip) and decompresses it upon receipt on the local side (zcat).

Note that ssh's compression is off on intention. Only the pipe's compression is used.

You may use other compression tools like bz2 or xz as well. Consider their respective performance impacts.

NOTE: It seems that, if the compression uses a very slow algorithm, the stream can fail to deliver in time and the connection "closes" with an error.

user569825
  • 331
  • 3
  • 5
  • 12
2

To know the protocol version of ssh, you can include -v option in your ssh command.

To request compression, you can use -C option. This should work even for protocol version 2.

Khaled
  • 35,688
  • 8
  • 69
  • 98
  • 1
    But what about CompressionLevel option? I don't want use the default level, 6, but the 9 cos I'm over a diulup connection. –  May 13 '12 at 14:54
  • 1
    @frankabel: As I understood from the manual, you can only set the compression level for protocol version 1, but I am not sure about this. – Khaled May 13 '12 at 14:56
  • 1
    Bad news, here http://lists.mindrot.org/pipermail/openssh-unix-dev/2003-November/019734.html I found that ssh2 is less capable than ssh1 regards compression configuration. –  May 13 '12 at 15:17
  • 1
    Seem to me that if want use max compression level (9), I must use ssh 1 instead of ssh 2 –  May 13 '12 at 15:22
  • 9
    Just leave it at the default and use ssh2. The difference isn't much, and the security gain from using v2 is worth it. – Bill Weiss May 13 '12 at 15:26