For SSH you can do something like the following:
ssh -o ProxyCommand='nc -x localhost:$orport %h %p' example.com
Options can also be configured in your
/etc/ssh/ssh_config, or the equivalent on your OS) file:
ProxyCommand /usr/bin/nc -x localhost:$orport %h %p
Rsync can then use ssh as its remote shell and it will pick up the previous config:
rsync -e ssh example:path/to/files /dest
or, by directly passing arguments to the remote shell:
rsync -e "ssh -o ProxyCommand='nc -x localhost:$orport %h %p'" example.com /dest
Finally, you can use the
RSYNC_CONNECT_PROG environment variable to set up all future RSYNC invocations to use Tor (without having to manually specify it each time):
export RSYNC_CONNECT_PROG='ssh proxyhost nc -x localhost:$orport %h %p'
rsync example.com:/src /dest
$orport with the port you've got Tor's SOCKS proxy listening on.