https://www.cyberciti.biz/faq/howto-use-tar-command-through-network-over-ssh-session/

This example is using a SSH keyfile to connect to a remote host then using sudo to gain access to a restricted directory and then back it up via tar to the home directory of the local computer you're running the command from. It will prompt you for your sudo password when run so can't be used via automation. Remove the sudo and -S options if you don't need sudo.

ssh -i ~/.ssh/user@domain.com-blebmin@websrv01.remotehost.com blebmin@ip.add.re.ss sudo -S tar czf - /var/www/ > ~/ht-websrv01.tar.gz