nullmeta's answer is completely valid, and perhaps nullmeta will edit to provide the clarification you're looking for. I'm posting a separate solution altogether to account for the situation where it may be difficult because of network structure (think NAT firewall) to simply ssh back into the local system.
Say you have two computers, ComputerA and ComputerB. ComputerA is your local workstation. ComputerB is a remote machine that you can access via ssh.
Scenario 1: If ComputerA is not behind an NAT firewall
This is a swift and easy solution, combining scp and ssh (scp performs a secure copy using ssh protocols). It requires you to have an ssh server (and client) installed on both ends (computerA and computerB).
To use this solution, run from ComputerB:
scp /path/to/file/on/ComputerB ComputerAUser@ComputerA:/path/to/dump/file/on/ComputerA
Scenario 2: If ComputerA is behind an NAT firewall
In this scenario, you would typically need to configure port-forwarding in the NAT firewall. However, you may not always have access to make these kinds of changes. In this case, you can configure your ssh tunnel from ComputerA -> ComputerB such it can tunnel reverse connections as well.
When establishing the ssh connection ComputerA -> ComputerB, do so with the -R option in the following manner.
ssh ComputerBUser@ComputerB -R 2222:localhost:22 where
ComputerBUser is the username for the account on ComputerB being authenticated and
2222 is a free port on ComputerB. We'll use this port to reverse-tunnel back to ComputerA from ComputerB.
Now from ComputerB, you can issue the scp command in the following manner to copy files from ComputerB -> ComputerA where
ComputerAUser is your username on ComputerA:
scp -P 2222 /path/to/file/on/ComputerB ComputerAUser@localhost:/path/to/drop/file/on/computerA
What's happening here? It looks like we are simply telling ComputerB to send the file back to itself because we're passing
localhost instead of ComputerA. We are indeed telling scp to pass the file back to ComputerB, but to port 2222. All connections to port 2222 on ComputerB get forwarded to port 22 (default ssh port) on ComputerA. Thus, by tunneling backwards over the existing ssh connection, it doesn't matter that ComputerA is behind an NAT firewall.
Scenario 3: perform the file copy from ComputerA
Or rather than trying to do it from ComputerB, you can just run the scp command from ComputerA.
scp ComputerBUser@ComputerB:/path/to/file/on/ComputerB /path/to/dump/file/on/ComputerA