News for hackers. Stuff that matters.
Re:File Transfer with SSH, Tee, and Base64 by waterhouse on Thursday September 17, 2020 @11:28AM (#24505835)
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>
Re:File Transfer with SSH, Tee, and Base64 by vlovich123 on Thursday September 17, 2020 @11:35AM (#24505919)
They 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.
Re:File Transfer with SSH, Tee, and Base64 by waterhouse on Thursday September 17, 2020 @12:17PM (#24506508)
I 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?

Re:File Transfer with SSH, Tee, and Base64 by jwilk on Thursday September 17, 2020 @01:07PM (#24507165)
I don't follow. How would any of these option help?
Re:File Transfer with SSH, Tee, and Base64 by susam on Thursday September 17, 2020 @12:51PM (#24506963)
The SSH gateway in between refuses to allocate PTY, so the -t option does not help.
Re:File Transfer with SSH, Tee, and Base64 by crumbshot on Thursday September 17, 2020 @11:54AM (#24506188)
> 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.