ssh-xfer for Transferring Files
![]() |
ssh-xfer uses the local SSH agent to transfer files using an existing connection. It can also do this over multiple connections: So if you've sshed into desktop A and then through that to server B, ssh-xfer will allow you to transfer a file directly from server B to your local machine. To make this work, you must patch your ssh-agent locally, and install the ssh-xfer binary remotely. Note that it is limited in that you can transfer files only from the remote machine to the local machine, not vice versa.
To get this set up, you'll need the OpenSSH source code locally so you can apply the patch and build the ssh-xfer binary. Download the OpenSSH patch from the Web site and save it to the OpenSSH source directory. Then run
patch -p0 < patch-file-nameNext, build the ssh-xfer binary, in the same directory, with:
./configure; make ssh-xfer
Finally, you must transfer the ssh-xfer binary to the remote server.
Now, run a bash shell via the new agent (ssh-agent-xfer bash), and open a connection to the server with agent forwarding enabled (ssh -A me@server.example.com). From this shell on the server, type ssh-xfer testfile.txt, and testfile will be put in ~/Desktop on your local machine. You can change this default location by editing the XFER_DEST_DIR value in the ssh-xfer patch.
Note that enabling agent forwarding is a slight security risk, but the convenience may well be worth it!


