scp in reverse?

Mike Ballon mike.ballon at gmail.com
Fri Mar 16 07:46:13 MST 2012


Yes and no. You can't directly, like this won't work:

tar xvf remotehost:test.tar .

This would, but you're really just copying the file and then
extracting with separate commands

scp remotehost:test.tar . ; tar xvf test.tar

Now you can tunnel with something like sshfs or you can actually pipe
to ssh. For instance I can tar a file up and send it over ssh like so:

tar cvf - 1.jpg | ssh remotehost "cat > 1.jpg.tar"

You could also do that in the opposite direction as well, although to
do this with a "reverse" would take some thinking :)

I suppose something like the following, although I can't test it right now.

ssh remotehost 'tar cvf - 1.jpg | ssh yoursourcehost "cat > 1.jpg.tar"'

maybe use the modifer -t with ssh "ssh -t" so you don't miss any
output. give a try see what happens. half the fun of *nix is figuring
out what works and what doesn't.

On Thu, Mar 15, 2012 at 3:01 PM, kitepilot at kitepilot.com
<kitepilot at kitepilot.com> wrote:
> Yes, scp (like cp) will copy back or forth, the 2 commands below are legal:
> scp myuser at remotebox:/that/file /this/path
> scp /this/path myuser at remotebox:/that/file
> 1st one will 'retrieve' /that/file from 'remotebox' into /this/path
> 2nd one will copy /this/path to /that/file in 'remotebox'.
> ET
>
> joe at actionline.com writes:
>>
>>
>> This is interesting.  Does this really mean that
>> scp in reverse is possible by using a similar syntax
>> with the dot at the end to extract a file from a remote
>> computer to my local computer?
>> -----------------
>> Mike Ballon wrote (in part) ... scp in reverse:
>> scp 192.168.0.4:Pictures/2009-Move.from.Florida .
>> I'm guessing the path of the pictures and take note of the dot at the end
>>
>>
>> ---------------------------------------------------
>> PLUG-discuss mailing list - PLUG-discuss at lists.plug.phoenix.az.us
>> To subscribe, unsubscribe, or to change your mail settings:
>> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
>
> ---------------------------------------------------
> PLUG-discuss mailing list - PLUG-discuss at lists.plug.phoenix.az.us
> To subscribe, unsubscribe, or to change your mail settings:
> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss


More information about the PLUG-discuss mailing list