Is there any way to transfer files from a server to a host computer, from within the server ssh connection? I am storage limited on an HPC, and so some jobs require transferring and then deleting files at intermediate stages. It would be great to be able to transfer the files to my host machine from within a job, but I think this might not be possible, given that the unix within an ssh connection does not know that it is an ssh connection.
As B Layer pointed out whenever, you are in a ssh tunnel your command/shell doesn't really know this. Basicly your command/shell works just like it wasn't in a tunnel (the beauty about ssh). That's also why tunnels inside tunnels work!
Goodies gave the answer you were looking for I think. SCP is a very nice tool using ssh to copy files in both a pull and push way depending your situation.
This link gives a very nice overview of the possibilities and the syntax of SCP!
Code you could use: where 192.168.1.100 is your server and 192.168.1.5 your client. Note that dns-names can be used as well.
Pulling: Let's say you have a terminal on your host open, you could do:
scp firstname.lastname@example.org:/tmp/myfile /tmp/files/myfile
This way you are creating a "second tunnel" towards your server.
Pushing: (The other way around) so from your server to your host (essentially it is now a tunnel in your original tunnel):
scp /tmp/myfile email@example.com:/tmp/files/myfile
I hope this explains the concepts a little!