Using tar over SSH Session

I wanted to make a tar of a folder on a remote server. But the server don’t have much disk space left, so the tar operation failed.

The server had no rsync installed to copy over the folder to another server.

To save generated tar file on another server, i used command

tar zcvf - folder-to-compress | ssh root@STORAGE_SERVER_IP "cat > site.tar.gz"

Example

tar zcvf - public_html | ssh [email protected] "cat > site.tar.gz"

NOTE: Make sure you connect to remote server using SSH and accept the key before you run above command as it will fail if you don’t accept key beforehand.

See tar

Need help with Linux Server or WordPress? We can help!

Leave a Reply

Your email address will not be published. Required fields are marked *