Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I never heard this possible, so probably the answer is not. But maybe someone knows better.

I know you can use sftp to exchange files between host and remote, and you can both: sftp from host to remote, and from remote to host once you are already connected to the remote with SSH.

But now my question, once you are connected to the remote machine with SSH is this possible to transfer files using already established connection? This is so logical, I am already connected, authentication is done, why not just have something like lls, put. Or use some combination of keys that will bypass remote bash input line and do something between hosts.

share|improve this question

Recent versions of OpenSSH support connection multiplexing. Look at the ControlMaster and ControlPath options for ssh_config.

Using this feature, you'd still have to run scp or sftp to perform a file transfer, but the transfer would run through your existing SSH connection.

share|improve this answer

You will always need to identify yourself to the machines you are connecting to. You can set it up to work with encrypted keys so no password is needed but the authentication is still there.

The easiest way to transfer files between remote systems is scp, part of the ssh package. Lets say your local machine is and your local user tom and the remote machine is and your remote user is jon.

  • To copy a file from the remote server to your local machine when logged in to the server:

    scp /home/jon/foo.txt tom@

    Of course, you will still have to identify yourself (to your local machine this time). Not, however, to the server.

  • To copy a file from the remote server to your local machine when not logged in to the server:

    scp jon@ /home/tom/

    This way, you only need to identify yourself once, you don't need to open a separate ssh connection.

You can also copy between remote servers, anywhere you have ssh access to basically. The general format of the command is

scp user1@machine1:/path/to/source user2@machine2/path/to/destination
share|improve this answer
The OP specifically wanted to reuse the existing SSH connection, not create a new one. How would he use scp and the existing connection to move files? – Darth Android Apr 26 '13 at 22:07
@DarthAndroid he would not initiate another ssh connection, just use scp, that way only one connection is established. Tongue in cheek, granted, but that's what scp is for. Also, I am assuming (perhaps wrongly, the OP may correct me) from the way the question was worded that the OP is not too familiar with scp which seems to me to be the most logical choice in the situation described. – terdon Apr 26 '13 at 22:15
If he's already connected via ssh, why does he need to bother with authentication or hosts in scp ? If it's just reusing the existing ssh connection, isn't he already authenticated and the host doesn't matter? @Kenster found the answer, though I think it needs to be fleshed out a bit more. – Darth Android Apr 26 '13 at 22:23
@DarthAndroid with @Kenster's (very good) suggestion won't the OP still need to identify to the local machine? Why not just run scp instead of connecting over ssh? – terdon Apr 26 '13 at 22:28
@terdon because I already connected with ssh many hours ago and keep performing various tasks, now I suddenly need only or few files from my local machine... so the question comes – exebook Apr 27 '13 at 3:34

Using an existing SSH session, but not necessarily SSH itself, you could try the trusty classic Zmodem rz/sz. These utilities may already be available on your system as they are available in RPM and DPKG format in various repos. Otherwise you can download and build them from here.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.