Gzip Piped to Rsync

My usual approach to this would be to use gzip and ssh as follows:

gzip -c file | ssh [email protected] "cat > destination.gz"

This will send the zip output over ssh straight into the file "destination.gz" on the remote host. If you're doing this manually, just enter your ssh password; if you want to do it automatically, you'll need to set up ssh keys, per something like this:

http://pkeck.myweb.uga.edu/ssh/


Don't take this personally, but from your question and comments it seems like you don't understand what rsync is actually for. It's not for moving files from one place to another – it's for synchronizing files between two places. If you don't want to keep a copy on the local machine, then you're not synchronizing, and rsync isn't the tool you want.

You're trying to transfer a file. For that, you can put it on disk and use ssh, ftp, sftp, ftps, and so on, or you can pipe it through ssh as Glenn suggested, which is the right answer and the only right way to do what you want. If you're worried about resource utilization (and for high-bandwidth connections this can make a difference), then change ciphers:

gzip -c somefile | ssh -c blowfish user@host 'cat > someotherfile'

If you try to do something (like pipe to rsync) and it doesn't work, it's possible you're doing it wrong, or it's possible you're trying to do the wrong thing. It's a question of tool for the job, and it's important not to rule out that whatever it is you're trying to do, there's a proper tool for it.

Understanding and keeping in mind the purpose of the sundry different tools available in a UNIX environment will let you use and manipulate that environment more effectively. A lot of tools have subtle differences or overlap in functionality, but unless you pay attention to them all, you'll miss out on a lot of the best ways to accomplish tasks.