Use tar Command Through Network Over SSH Session

# tar zcvf - /wwwdata | ssh "cat > /backup/wwwdata.tar.gz"OR# tar zcvf - /wwwdata | ssh root@ "cat > /backup/wwwdata.tar.gz"


tar: Removing leading `/' from member names

You can also use dd command for clarity purpose:
# tar cvzf - /wwwdata | ssh root@ "dd of=/backup/wwwdata.tar.gz"
It is also possible to dump backup to remote tape device:
# tar cvzf - /wwwdata | ssh root@ "cat > /dev/nst0"
OR you can use mt to rewind tape and then dump it using cat command:
# tar cvzf - /wwwdata | ssh root@ $(mt -f /dev/nst0 rewind; cat > /dev/nst0)$
You can restore tar backup over ssh session: # cd /
# ssh root@ "cat /backup/wwwdata.tar.gz" | tar zxvf -
If you wish to use above command in cron job or scripts then consider SSH keys to get rid of the passwords.