I have 2 Servers.
Server A has a lot of data but a very small CPU. Server B hosts no Data but has a strong CPU.
Now i want Server B to get the data from Server A, compress it and send it back via stdout, but nothing happens and the compressed file is not even created on Server A.
Here is the command i am using on Server B:
ssh user@serverA "tar cf - /media/data" | zstd --stdout | ssh user@serverA "cat > foo.tar.zst"
When i use the command without the ssh part is is working fine:
ssh user@serverA "tar cf - /media/data" | zstd --stdout | cat > foo.tar.zst
Is this a bug or intended?
Paraphrasing your example command worked just fine for me:
ssh some.host.name "tar cf - some/dir" | zstd --stdout | ssh some.host.name "cat >some.file.tar.zst"
It sounds like this is an ssh or shell problem on your end, rather than a zstd problem. You can verify that this is the case if you sub in gzip instead of zstd, for example. You could also try doing the second ssh but cat a local file in and see if that part works. If it does, I'm guessing it's the two ssh commands fighting. (Over the terminal, maybe? So they can grab it to get a password from you?)
I think you were right with the two ssh commands and the terminal.
I found out that when i copy my ssh-key to ServerA instead of using a password it seems to work.
So the problem was more or less the 2 ssh password prompts.
The workaround for this is therefore to:
ssh-copy-id user@serverA
thanks @felixhandte
Most helpful comment
Paraphrasing your example command worked just fine for me:
It sounds like this is an ssh or shell problem on your end, rather than a zstd problem. You can verify that this is the case if you sub in
gzipinstead ofzstd, for example. You could also try doing the second ssh but cat a local file in and see if that part works. If it does, I'm guessing it's the two ssh commands fighting. (Over the terminal, maybe? So they can grab it to get a password from you?)