4 ms·
If you can SSH directly into both systems, then you don't need to print anything directly to the terminal. You can go: ssh system1 'cat payload' > temp ca
by waterhouse 6y ago
If you can SSH directly into both systems, then you don't need to print anything directly to the terminal. You can go:
ssh system1 'cat payload' > temp
cat temp | ssh system2 'cat > payload'
Or cut out the middleman, as long as getting two password prompts isn't too confusing:
ssh system1 'cat payload' | ssh system2 'cat > payload'
I've found the base64/copy-paste trick useful when I can't do a conventional SSH. Usually this is when one of the machines is accessed via a serial console.
In that scenario, it can help to compress the data before base64-ing it:
machine1$ cat payload | gzip | base64
<output>
machine2$ base64 -d | gzip -d > payload
<paste output>
- vlovich123 6y agoThey mention that you can’t run commands without an interactive shell. I believe that knocks out your proposal because then rsync+ssh would work without all the complexity you have in your post with all the same benefits. Could be wrong though.
- waterhouse 6y agoI see, I did miss that. I do wonder if there's a workaround for that, though. "bash" has the "-l" option for "Make bash act as if it had been invoked as a login shell", and also "-i" forces interactive mode. For ssh, "-t" is "Force pseudo-terminal allocation"; would that work?
- deleted 6y ago[deleted]
- crumbshot 6y ago> Usually this is when one of the machines is accessed via a serial console. I've found zssh can be quite handy for that, it layers an extra pty over the SSH connection, for file transfer. By default it uses the ZMODEM protocol via rz/sz, but any pair of programs can be plugged in instead - useful if the connection isn't 8-bit clean.