Does SSH use any compression?
No and yes. Kind of. Which is to say, it supports compression (zlib or zlib-ish, as I recall), but a stock copy of OpenSSH does not have it enabled by default, though some distributions may enable it by default (I don't think Ubuntu does).
See man ssh_config
for details. You're looking for the Compression
and CompressionLevel
options, which you can then set in /etc/ssh/ssh_config
.
Note that there's also a Compression
option for the server side in sshd_config
which determines if compression is allowed (it is by default). Again, see man sshd_config
for details.
You can also turn compression on on a per-session basis by using the command line option -C
.
Note that compression can actually have a slightly negative performance impact if the connection between you and the server is fast (e.g. on the same LAN or just on really good internet connections) or one or both sides has a slow CPU (compression eats a fair bit of CPU time).
These days, for most people, I'd suggest using it only as needed. Typically for links of less than 5-10mbps and only when passing a lot of bulk data (transfers of not-already-compressed files, X11 or VNC forwarding, things like that).
You can turn on gzip compression on any SSH. Put Compression yes
into your ~/.ssh/config
, and it should work. Alternatively, try running ssh
with the -C
option.
From the ssh man page (type man ssh
to see the whole thing):
-C Requests compression of all data (including stdin, stdout,
stderr, and data for forwarded X11 and TCP connections). The
compression algorithm is the same used by gzip(1), and the
“level” can be controlled by the CompressionLevel option for pro-
tocol version 1. Compression is desirable on modem lines and
other slow connections, but will only slow down things on fast
networks. The default value can be set on a host-by-host basis
in the configuration files; see the Compression option.
So just change:
ssh hostname
to:
ssh -C hostname
Easiest why is to use the -o option, on the cli. It can be used with any config option as well eg
ssh -o "Compression no" -v <HOST>
# or
ssh -o "Compression yes" -v <HOST>