How to transfer files over ssh while already ssh’d into the server

file-transferssh

I transfer files using this command

scp <localfile> user@host:<destination>

The above command only works when I'm not ssh'd into the server.

How do I transfer local files to the host machine when I'm already ssh'd in??

I ssh in using ssh user@hostname

Best Answer

Nice question. scp again, but the opposite way. I did it and here it is:

chris@local ~$ ls hos*
hosts
chris@local ~$ ssh remote
Last login: Fri Mar  8 15:52:25 2013 from local
chris@remote ~$ scp chris@local:hos* .
chris@local's password: 
hosts                                              100% 1850     1.8KB/s   00:00    
chris@remote ~$ ls hos*
hosts
chris@remote ~$ 

edited to add: as pointed out in the comments, this requires that the remote computer can access the local computer. And sshd or (openssh-server) needs to be installed and running on the local machine.

Related Question