How much data does SSH typically use?

what is the typical amount that an ssh session uses?

I'm not sure there is "typical"

You should run tcpdump -ni eth0 -w dump port 22 to capture all your packets, then tcpdump -nX -r dump to view them.

Is there some sort of relation, e.g. that using ls on a directory with 50 items will cost me a certain amount of data?

You could compute that. As a rough estimate, every keystroke will generate 4 packets (keypress, ack, echo on screen, ack) and each packet will have tons of overhead. (My TCP dump says 500 bytes to type 2 characters.)

My directory listing of 135 files took 2.5k.

Using ssh -C compression should help for the bigger text.

Or is it more time dependent and does an ssh session transmit a certain amount of data per time interval, regardless of use?

Yes. Both TCP and SSH have keepalive probes. This will be an issue if you keep it up all the time. Again, use TCPDump to measure.

My advice: instead of worrying, make sure you actually have realtime feedback on your usage. After you use a few sessions, you'll be able know how close you are.


I have a similar setup (3G connection on a remote Ubuntu laptop).

While I agree there is no "typical" answer (it depends both on your own usage, as well as sshd/ssh options like "keepalive" frequency, ssh compression & perhaps other ssh options), I've been able to reduce my basic idle ssh bandwidth to 0.2 - 0.3MB / hour (works out to 200MB/month).

I've used tcpdump and then wireshark to visualise and measure my bandwidth usage (in addition to the interface's RX bytes/TX bytes using ifconfig).

0.2 - 0.3MB bandwidth on my rig is with the following options: TCPKeepAlive no (sshd server, sshd_config) and ServerAliveInterval 180, ServerAliveCountMax 40, TCPKeepAlive no (on the client, i.e. ssh_config)

Hope this helps, if not you, then other users with a similar setup.


SSH is basically sending the command and the screen output. If you're just doing command line stuff, a rough estimate would be a byte per character on your screen.

Obviously, if you tunnel an X session, SCP to transfer files, etc, the bandwidth will go up.

I say it's a rough estimate as there's some overhead. You can also use the -C flag to request compression.

Tags:

Linux

Ssh

Bitrate