copy from remote location to another remote location through localhost
copy from remote location to another remote location through localhost
am 21.01.2008 16:19:29 von jimmij
Hello!
There are 3 computers: A, B and C. To ssh (scp) from A to C (and from C
to A) one has to go through B. I want to copy a file from A to C in one
step. So I need something like:
scp --go-through-local-host userA@A:file.txt userB@B:
Is there such tool on the market?
TIA
--
jimmij
Re: copy from remote location to another remote location through localhost
am 21.01.2008 16:31:46 von Stephane CHAZELAS
On Mon, 21 Jan 2008 16:19:29 +0100, jimmij wrote:
> Hello!
>
> There are 3 computers: A, B and C. To ssh (scp) from A to C (and from C
> to A) one has to go through B. I want to copy a file from A to C in one
> step. So I need something like:
> scp --go-through-local-host userA@A:file.txt userB@B:
[...]
Not sure what you mean. What about something along those lines:
ssh userA@A 'gzip < file.txt' | ssh userB@B 'gunzip > file.txt'
--
Stephane
Re: copy from remote location to another remote location throughlocalhost
am 21.01.2008 16:34:51 von Burkhard Ott
Am Mon, 21 Jan 2008 16:19:29 +0100 schrieb jimmij:
> Hello!
>
> There are 3 computers: A, B and C. To ssh (scp) from A to C (and from C
> to A) one has to go through B. I want to copy a file from A to C in one
> step. So I need something like:
> scp --go-through-local-host userA@A:file.txt userB@B:
>
> Is there such tool on the market?
>
> TIA
netcat, but it also works with ssh and hostkeys
Re: copy from remote location to another remote location throughlocalhost
am 21.01.2008 19:21:03 von wayne
jimmij wrote:
> Hello!
>
> There are 3 computers: A, B and C. To ssh (scp) from A to C (and from C
> to A) one has to go through B. I want to copy a file from A to C in one
> step. So I need something like:
> scp --go-through-local-host userA@A:file.txt userB@B:
>
> Is there such tool on the market?
>
> TIA
ssh userA@A 'scp file.txt userC@C:'
-Wayne
Re: copy from remote location to another remote location through localhost
am 21.01.2008 19:34:57 von jimmij
jimmij writes:
> Hello!
>
> There are 3 computers: A, B and C. To ssh (scp) from A to C (and from C
> to A) one has to go through B. I want to copy a file from A to C in one
> step. So I need something like:
> scp --go-through-local-host userA@A:file.txt userB@B:
There is (of course) misprint. Should be
scp --go-through-local-host userA@A:file.txt userC@C:
(while I'm on B).
--
jimmij
Re: copy from remote location to another remote location throughlocalhost
am 21.01.2008 20:41:52 von Icarus Sparry
On Mon, 21 Jan 2008 13:21:03 -0500, Wayne wrote:
> jimmij wrote:
>> Hello!
>>
>> There are 3 computers: A, B and C. To ssh (scp) from A to C (and from C
>> to A) one has to go through B. I want to copy a file from A to C in one
>> step. So I need something like:
>> scp --go-through-local-host userA@A:file.txt userB@B:
>>
>> Is there such tool on the market?
>>
>> TIA
>
> ssh userA@A 'scp file.txt userC@C:'
>
> -Wayne
This of course fails the OP's request that it goes through the local
machine (B).
Stephane's suggestion
ssh userA@A 'gzip < file.txt' | ssh userC@C 'gunzip > file.txt'
if better. However you need to see if ssh is already compressing the data
stream, and avoid doing so a second time. It also does not allow transfer
of the file attributes, e.g. owner and modification time. I would use
ssh userA@A 'tar cf - file.txt' | ssh userC@C 'tar xf -'
together with a sensible ~/.ssh/config file which set compression levels
in a manner that was appropriate. I might even use aliases for A and C if
this was something that I expected to do a lot of.
Re: copy from remote location to another remote location through
am 21.01.2008 23:23:16 von franzi
On 21 Gen, 20:41, Icarus Sparry wrote:
> On Mon, 21 Jan 2008 13:21:03 -0500, Wayne wrote:
> > jimmij wrote:
> >> Hello!
>
> >> There are 3 computers: A, B and C. To ssh (scp) from A to C (and from C=
> >> to A) one has to go through B. I want to copy a file from A to C in one=
> >> step. So I need something like:
> >> scp --go-through-local-host userA@A:file.txt userB@B:
>
> >> Is there such tool on the market?
>
> >> TIA
>
> > ssh userA@A 'scp file.txt userC@C:'
>
> > -Wayne
>
> This of course fails the OP's request that it goes through the local
> machine (B).
>
> Stephane's suggestion
> =A0 =A0ssh userA@A 'gzip < file.txt' | ssh userC@C 'gunzip > file.txt'
> if better. However you need to see if ssh is already compressing the data
> stream, and avoid doing so a second time. It also does not allow transfer
> of the file attributes, e.g. owner and modification time. I would use
>
> ssh userA@A 'tar cf - file.txt' | ssh userC@C 'tar xf -'
>
> together with a sensible ~/.ssh/config file which set compression levels
> in a manner that was appropriate. I might even use aliases for A and C if
> this was something that I expected to do a lot of.
Netcat un both sides of A B C and is fast
remote side $nc -l -p 9000 > file;
local side-$ cat file |nc -w 3 ip 9000 ,as to in that way not sure but
give a probe
Re: copy from remote location to another remote location through
am 21.01.2008 23:47:44 von Icarus Sparry
On Mon, 21 Jan 2008 14:23:16 -0800, franzi wrote:
> On 21 Gen, 20:41, Icarus Sparry wrote:
>> On Mon, 21 Jan 2008 13:21:03 -0500, Wayne wrote:
>> > jimmij wrote:
>> >> Hello!
>>
>> >> There are 3 computers: A, B and C. To ssh (scp) from A to C (and
>> >> from C to A) one has to go through B. I want to copy a file from A
>> >> to C in one step. So I need something like:
>> >> scp --go-through-local-host userA@A:file.txt userB@B:
>>
>> >> Is there such tool on the market?
>>
>> >> TIA
>>
>> > ssh userA@A 'scp file.txt userC@C:'
>>
>> > -Wayne
>>
>> This of course fails the OP's request that it goes through the local
>> machine (B).
>>
>> Stephane's suggestion
>> Â Â ssh userA@A 'gzip < file.txt' | ssh userC@C 'gunzip > file.txt'
>> if better. However you need to see if ssh is already compressing the
>> data stream, and avoid doing so a second time. It also does not allow
>> transfer of the file attributes, e.g. owner and modification time. I
>> would use
>>
>> ssh userA@A 'tar cf - file.txt' | ssh userC@C 'tar xf -'
>>
>> together with a sensible ~/.ssh/config file which set compression
>> levels in a manner that was appropriate. I might even use aliases for A
>> and C if this was something that I expected to do a lot of.
>
> Netcat un both sides of A B C and is fast remote side
> $ nc -l -p 9000 > file;
> local side-
> $ cat file |nc -w 3 ip 9000 ,as to in that way not sure but
> give a probe
ssh will be as fast as netcat if no encryption is used. Depending on the
circumstances this may or may not be a good thing. It can however be
specified in the config file.
You left out the commands to run on host B
nc -l -p 9000 | nc -w 3 C 9000
and it would be helpful if you explained which address you ment when you
said "ip".
Re: copy from remote location to another remote location through localhost
am 22.01.2008 02:21:58 von gerg
jimmij writes:
>
>There are 3 computers: A, B and C. To ssh (scp) from A to C (and from C
>to A) one has to go through B. I want to copy a file from A to C in one
>step. So I need something like:
>scp --go-through-local-host userA@A:file.txt userB@B:
>
>Is there such tool on the market?
>
There used to be. UUCP
-Greg
--
::::::::::::: Greg Andrews ::::: gerg@panix.com :::::::::::::
I have a map of the United States that's actual size.
-- Steven Wright
Re: copy from remote location to another remote location throughlocalhost
am 22.01.2008 04:39:59 von wayne
jimmij wrote:
> jimmij writes:
>
>> Hello!
>>
>> There are 3 computers: A, B and C. To ssh (scp) from A to C (and from C
>> to A) one has to go through B. I want to copy a file from A to C in one
>> step. So I need something like:
>> scp --go-through-local-host userA@A:file.txt userB@B:
>
> There is (of course) misprint. Should be
> scp --go-through-local-host userA@A:file.txt userC@C:
>
> (while I'm on B).
>
That's what I thought you meant. Some of these other posters
think you want to transfer from A to A and then to C, but
of course what you wanted was, while on B, to instruct A to send
the files to C. Or instruct C to grab the files from A.
See my answer for a method to do this. (In the olden days
we used "uux" to run a "uucp" command from A to copy files to C.
This came up more often than you'd think!)
-Wayne
Re: copy from remote location to another remote location throughlocalhost
am 22.01.2008 04:41:47 von wayne
Icarus Sparry wrote:
>>> There are 3 computers: A, B and C. To ssh (scp) from A to C (and from C
>>> to A) one has to go through B. I want to copy a file from A to C in one
>>> step. So I need something like:
>>> scp --go-through-local-host userA@A:file.txt userB@B:
>>>
>>> Is there such tool on the market?
>>>
>>> TIA
>> ssh userA@A 'scp file.txt userC@C:'
>>
>> -Wayne
>
> This of course fails the OP's request that it goes through the local
> machine (B).
I think you mis-understood the OP. That wasn't his request, that
was his problem that he wanted to avoid.
-Wayne
Re: copy from remote location to another remote location through
am 22.01.2008 09:43:02 von franzi
On 22 Gen, 04:41, Wayne wrote:
> Icarus Sparry wrote:
> >>> There are 3 computers: A, B and C. To ssh (scp) from A to C (and from =
C
> >>> to A) one has to go through B. I want to copy a file from A to C in on=
e
> >>> step. So I need something like:
> >>> scp --go-through-local-host userA@A:file.txt userB@B:
>
> >>> Is there such tool on the market?
>
> >>> TIA
> >> ssh userA@A 'scp file.txt userC@C:'
>
> >> -Wayne
>
> > This of course fails the OP's request that it goes through the local
> > machine (B).
>
> I think you mis-understood the OP. =A0That wasn't his request, that
> was his problem that he wanted to avoid.
>
> -Wayne
If i'm right jimmij said
I want to copy a file from A to C in one step
but do you have accsess to C,if not,i do not know how is that
possible,and you want to view all the data that run through B,is that
right?
the only way, i can immagine is ssh,but for sure there are othere
methode,let me know,
a part hacking style
Re: copy from remote location to another remote location through localhost
am 22.01.2008 14:17:34 von jimmij
franzi writes:
>> >> ssh userA@A 'scp file.txt userC@C:'
>>
>> >> -Wayne
>>
>> > This of course fails the OP's request that it goes through the local
>> > machine (B).
>>
>> I think you mis-understood the OP. That wasn't his request, that
>> was his problem that he wanted to avoid.
>>
>> -Wayne
>
> If i'm right jimmij said
> I want to copy a file from A to C in one step
> but do you have accsess to C,if not,i do not know how is that
> possible,and you want to view all the data that run through B,is that
> right?
> the only way, i can immagine is ssh,but for sure there are othere
> methode,let me know,
> a part hacking style
A lot of confusion...
1. B is a firewall.
2. To reach A from C (and vice versa) first I have to go to B.
3. Up to now to copy from A to C I first copied from A to B, and then
from B to C (being all the time on B).
Hope that is clear right now.
ps. Wayne solution doesn't work for me.
--
jimmij
Re: copy from remote location to another remote location through localhost
am 22.01.2008 14:20:54 von jimmij
Wayne writes:
>> scp --go-through-local-host userA@A:file.txt userC@C:
>> (while I'm on B).
>>
>
> That's what I thought you meant. Some of these other posters
> think you want to transfer from A to A and then to C, but
> of course what you wanted was, while on B, to instruct A to send
> the files to C. Or instruct C to grab the files from A.
> See my answer for a method to do this.
Your solution doesn't work. Please note, that I want to send from A to C
via B (localhost). B is a firewall and I cannot scp from A to C
directly.
--
jimmij
Re: copy from remote location to another remote location through localhost
am 22.01.2008 14:27:52 von jimmij
gerg@panix.com (Greg Andrews) writes:
> There used to be. UUCP
man uucp sounds promising, but it is not available on the system (and I'm
not admistrator on any of those systems).
--
jimmij
Re: copy from remote location to another remote location through localhost
am 22.01.2008 15:20:55 von Icarus Sparry
On Tue, 22 Jan 2008 14:17:34 +0100, jimmij wrote:
> franzi writes:
>
>>> >> ssh userA@A 'scp file.txt userC@C:'
>>>
>>> >> -Wayne
>>>
>>> > This of course fails the OP's request that it goes through the local
>>> > machine (B).
>>>
>>> I think you mis-understood the OP. Â That wasn't his request, that was
>>> his problem that he wanted to avoid.
>>>
>>> -Wayne
The OP has clarified the original request and it appears that I had
correctly interpreted what he wanted.
>> If i'm right jimmij said
>> I want to copy a file from A to C in one step but do you have accsess
>> to C,if not,i do not know how is that possible,and you want to view all
>> the data that run through B,is that right?
>> the only way, i can immagine is ssh,but for sure there are othere
>> methode,let me know,
>> a part hacking style
>
> A lot of confusion...
>
> 1. B is a firewall.
> 2. To reach A from C (and vice versa) first I have to go to B. 3. Up to
> now to copy from A to C I first copied from A to B, and then from B to C
> (being all the time on B).
>
> Hope that is clear right now.
>
> ps. Wayne solution doesn't work for me.
Does the solution that Stephane & I suggest work (on the firewall run ssh
A "tar cf - file" | ssh C "tar xf -").
Re: copy from remote location to another remote location through localhost
am 22.01.2008 15:46:40 von Stephane CHAZELAS
On Tue, 22 Jan 2008 14:20:54 +0100, jimmij wrote:
> Wayne writes:
>
>>> scp --go-through-local-host userA@A:file.txt userC@C:
>>> (while I'm on B).
>>>
>>
>> That's what I thought you meant. Some of these other posters
>> think you want to transfer from A to A and then to C, but
>> of course what you wanted was, while on B, to instruct A to send
>> the files to C. Or instruct C to grab the files from A.
>> See my answer for a method to do this.
>
> Your solution doesn't work. Please note, that I want to send from A to C
> via B (localhost). B is a firewall and I cannot scp from A to C
> directly.
Looks like:
ssh -o Compression=yes userA@A 'tar cf - file.txt' |
ssh -o Compression=yes userC@C 'tar xpf -'
(from B) as suggested by Icarus would work for you.
Or from C:
ssh userB@B 'ssh userA@A "tar cf - file.txt"' | tar xpf -
(add the compression option if need be).
(this assumes that you have your keys configured properly so
that no passwd is asked).
--
Stephane
Re: copy from remote location to another remote location through localhost
am 22.01.2008 15:54:36 von jimmij
Icarus Sparry writes:
> Does the solution that Stephane & I suggest work (on the firewall run ssh
> A "tar cf - file" | ssh C "tar xf -").
Yes, it does.
But as a perfectionist I somehow don't like to use external commands ;)
--
jimmij
Re: copy from remote location to another remote location through localhost
am 22.01.2008 16:00:16 von Stephane CHAZELAS
On Tue, 22 Jan 2008 15:54:36 +0100, jimmij wrote:
> Icarus Sparry writes:
>
>> Does the solution that Stephane & I suggest work (on the firewall run ssh
>> A "tar cf - file" | ssh C "tar xf -").
>
> Yes, it does.
> But as a perfectionist I somehow don't like to use external commands ;)
[...]
External to what? What do you think scp, sshd are internal to?
--
Stephane
Re: copy from remote location to another remote location through localhost
am 23.01.2008 22:23:41 von Michal Nazarewicz
Stephane Chazelas writes:
> On Tue, 22 Jan 2008 14:20:54 +0100, jimmij wrote:
>> Wayne writes:
>>
>>>> scp --go-through-local-host userA@A:file.txt userC@C:
>>>> (while I'm on B).
>>>>
>>>
>>> That's what I thought you meant. Some of these other posters
>>> think you want to transfer from A to A and then to C, but
>>> of course what you wanted was, while on B, to instruct A to send
>>> the files to C. Or instruct C to grab the files from A.
>>> See my answer for a method to do this.
>>
>> Your solution doesn't work. Please note, that I want to send from A to C
>> via B (localhost). B is a firewall and I cannot scp from A to C
>> directly.
>
> Looks like:
>
> ssh -o Compression=yes userA@A 'tar cf - file.txt' |
> ssh -o Compression=yes userC@C 'tar xpf -'
The data is compressed and decompressed twice. Better would be:
ssh -o Compression=no userA@A 'tar cf - file.txt | gzip -9' |
ssh -o Compression=no userC@C 'gzip -d | tar xpf -'
as it compresses data only one time.
--
Best regards, _ _
.o. | Liege of Serenly Enlightened Majesty of o' \,=./ `o
..o | Computer Science, Michal "mina86" Nazarewicz (o o)
ooo +------ooO--(_)--Ooo--