As pointed out in this Ask Ubuntu answer, you may use zssh
instead of ssh
. When using zssh
, you'll be able to switch to file transfer mode using Ctrl + @. This should allow you to transfer files back and forth between the local and remote ends of your active connection.
Another trick pointed out in that answer is to send ssh
to the background while you call scp
. This may require re-authentication though, but if you setup passkey authentication, this shouldn't be a problem. To send ssh
to the background, hit Ctrl + Z. You should then be able to call scp
, and get ssh
back when you're done, using fg
.
Edit: as pointed out by muru, in order to handle Ctrl + Z locally, and not remotely, you'll have to use Enter, ~, Ctrl + Z. See about SSH escape sequences.
Basically, scp
and ssh
just don't work the same way. You'll need a trick to make one do the other's job. Some of those tricks are given in the question I linked earlier.
Otherwise, a duplicate question: http://unix.stackexchange.com/questions/106480/how-to-copy-files-from-one-machine-to-another-using-ssh and http://unix.stackexchange.com/questions/4552/copy-text-from-one-terminal-into-another/4557#4557
– Ian McGowan Dec 09 '14 at 04:39scp
the other way around.scp host:/path/to/file .
(related: http://askubuntu.com/questions/13382/download-a-file-over-an-active-ssh-session) – John WH Smith Dec 09 '14 at 08:21