torsdag 30 augusti 2012

Bandwidth limit ssh

For all you who are interested in rate limiting ssh, to not consume too much bandwidth, here is a suggestion:

Use trickle! (apt-get install trickle for debian/ubuntu users)

instead of
ssh you@example.com
you use
trickle -u 123 -d 456 ssh you@example.com

where u is the upload limit in kbytes/s and d is the download limit in kbytes/s.

Very handy. I use it to rate limit file synchronization with unison. I have a ssh.sh script with
#!/bin/sh
trickle -u 20 -d 40 ssh "$@"
in it, and sshcmd=/path/to/ssh.sh in my unison profile.

Good luck!