fixunix
Tags Register FAQ Members List Social Groups Calendar Search Today's Posts Mark Forums Read

Should I be able to scp between two remote hosts? - SSH

This is a discussion on Should I be able to scp between two remote hosts? - SSH ; Even with ssh-agent running and both private keys activated, I can never get scp to work directly between two remote hosts, but I can do it indirectly by copying to and from the local host: $ scp foo:~/test.txt bar:~/ Permission ...


Fix Unix > Technologies & Tools > Protocols > SSH > Should I be able to scp between two remote hosts?

Reply
 
LinkBack Tools
  #1  
Old 12-03-2007, 10:12 PM
Junior Member
 
Join Date: Sep 2009
Posts: 0
Default Should I be able to scp between two remote hosts?

Even with ssh-agent running and both private keys activated, I can
never get scp to work directly between two remote hosts, but I can do
it indirectly by copying to and from the local host:


$ scp foo:~/test.txt bar:~/
Permission denied, please try again.
Permission denied, please try again.
Permission denied (publickey,password,keyboard-interactive).
lost connection

$ scp foo:~/test.txt .
test.txt 100% 1166 1.1KB/s 00:00

$ scp test.txt bar:~/
test.txt 100% 1166 1.1KB/s 00:00


Is the failure of the first command above normal, or have I
misconfigured something?

Thanks,
Adam
Reply With Quote
  #2  
Old 12-04-2007, 04:47 AM
Junior Member
 
Join Date: Sep 2009
Posts: 0
Default Re: Should I be able to scp between two remote hosts?

>>>>> "AF" == Adam Funk writes:

AF> Even with ssh-agent running and both private keys activated, I can
AF> never get scp to work directly between two remote hosts, but I can
AF> do it indirectly by copying to and from the local host:


AF> $ scp foo:~/test.txt bar:~/ Permission denied, please try again.
AF> Permission denied, please try again. Permission denied
AF> (publickey,password,keyboard-interactive). lost connection

AF> $ scp foo:~/test.txt . test.txt 100% 1166 1.1KB/s 00:00

AF> $ scp test.txt bar:~/ test.txt 100% 1166 1.1KB/s 00:00


AF> Is the failure of the first command above normal, or have I
AF> misconfigured something?

AF> Thanks, Adam

"scp foo:bar baz:blurfl" runs (essentially) "ssh foo scp bar baz:blurfl",
so authentication has to work from foo to bar directly.

--
Richard Silverman
res@qoxp.net

Reply With Quote
  #3  
Old 12-04-2007, 12:36 PM
Junior Member
 
Join Date: Sep 2009
Posts: 0
Default Re: Should I be able to scp between two remote hosts?

On 2007-12-04, Richard E. Silverman wrote:

>>>>>> "AF" == Adam Funk writes:

>
> AF> Even with ssh-agent running and both private keys activated, I can
> AF> never get scp to work directly between two remote hosts, but I can
> AF> do it indirectly by copying to and from the local host:
>
>
> AF> $ scp foo:~/test.txt bar:~/ Permission denied, please try again.
> AF> Permission denied, please try again. Permission denied
> AF> (publickey,password,keyboard-interactive). lost connection
>
> AF> $ scp foo:~/test.txt . test.txt 100% 1166 1.1KB/s 00:00
>
> AF> $ scp test.txt bar:~/ test.txt 100% 1166 1.1KB/s 00:00
>
>
> AF> Is the failure of the first command above normal, or have I
> AF> misconfigured something?
>
> AF> Thanks, Adam
>
> "scp foo:bar baz:blurfl" runs (essentially) "ssh foo scp bar baz:blurfl",
> so authentication has to work from foo to bar directly.


Aha, I understand. The problem isn't my configuration but that I was
trying to do something that turns out to be unreasonable --- although
man scp makes it sound OK.

Thanks for the explanation.
Reply With Quote
  #4  
Old 12-04-2007, 03:11 PM
Junior Member
 
Join Date: Sep 2009
Posts: 0
Default Re: Should I be able to scp between two remote hosts?

At 2007-12-03 11:47PM, "Richard E. Silverman" wrote:
> >>>>> "AF" == Adam Funk writes:

> AF> Even with ssh-agent running and both private keys activated, I can
> AF> never get scp to work directly between two remote hosts, but I can
> AF> do it indirectly by copying to and from the local host:

[...]
> "scp foo:bar baz:blurfl" runs (essentially) "ssh foo scp bar baz:blurfl",
> so authentication has to work from foo to bar directly.


The ssh "-A" option for agent forwarding would be useful here. Anyone
know why scp does not have that option?

--
Glenn Jackman
"You can only be young once. But you can always be immature." -- Dave Barry
Reply With Quote
  #5  
Old 12-04-2007, 05:45 PM
Junior Member
 
Join Date: Sep 2009
Posts: 0
Default Re: Should I be able to scp between two remote hosts?

The "man" page state explicitly that this can be done:

"Any file name may contain a host and user specification to indicate
that the file is to be copied to/from that host. Copies between two
remote hosts are permitted."

I've done it and AFAIK it requires that a) the key used be one of the
defaults, like id_rsa or id_dsa, b) no passphrase, c) all three
servers (the one issuing the command and the two remotes) accept the
default from the other.

Assume SvrA is where the scp command will be issued, SvrB and Svrc are
the remotes that are the source and destination of the copied file.

on SvrA, run "ssh-keygen -t dsa -f ~/.ssh/id_dsa", and hit enter at
both "pass-phrase" prompts.

add id_dsa.pub to ~/.ssh/authorized_keys on SvrA. Copy, by whatever
means you choose, the id_dsa.pub file to both SvrB and SvrC. Add it
to the appropriate "authorized_keys" file on both B and C.

now "slogin" in from A->B, A->C, B->A, B->C, C->A and C->B. This gets
the appropriate info into the "known_hosts" file on each machine.

Once all of the above function properly, on SvrA you should be able to
run:

scp SvrB:/some_source_file SvrC:/some_destination_file


Note that you can extend this to:

scp MyFirstID@SvrB:/source_file MySecondID@SvrC:/dest_file

It's a matter of getting the keys in the the correct files for each
ID / Server you want to use.

There may be other methods...but this is what I've got working.
Reply With Quote
  #6  
Old 12-05-2007, 09:03 PM
Junior Member
 
Join Date: Sep 2009
Posts: 0
Default Re: Should I be able to scp between two remote hosts?

On 2007-12-04, OldSchool wrote:

> The "man" page state explicitly that this can be done:


That's why I was trying to do it!


> I've done it and AFAIK it requires that a) the key used be one of the
> defaults, like id_rsa or id_dsa, b) no passphrase, c) all three
> servers (the one issuing the command and the two remotes) accept the
> default from the other.


I don't think it's worth having passphrase-free keys just for the rare
occasions when it would be useful to do this remote-remote copying.

Thanks for the explanation.
Reply With Quote
  #7  
Old 12-06-2007, 08:38 AM
Junior Member
 
Join Date: Sep 2009
Posts: 0
Default Re: Should I be able to scp between two remote hosts?

On 5 Dec, 21:03, Adam Funk wrote:
> On 2007-12-04, OldSchool wrote:
> > The "man" page state explicitly that this can be done:

>
> That's why I was trying to do it!
>
> > I've done it and AFAIK it requires that a) the key used be one of the
> > defaults, like id_rsa or id_dsa, b) no passphrase, c) all three
> > servers (the one issuing the command and the two remotes) accept the
> > default from the other.

>
> I don't think it's worth having passphrase-free keys just for the rare
> occasions when it would be useful to do this remote-remote copying.
>
> Thanks for the explanation.


You can load the keys via ssh-agent for typing free use. That's what
it's for.
Reply With Quote
  #8  
Old 12-06-2007, 08:50 PM
Junior Member
 
Join Date: Sep 2009
Posts: 0
Default Re: Should I be able to scp between two remote hosts?

In article Glenn Jackman
writes:
>At 2007-12-03 11:47PM, "Richard E. Silverman" wrote:
>> >>>>> "AF" == Adam Funk writes:

>> AF> Even with ssh-agent running and both private keys activated, I can
>> AF> never get scp to work directly between two remote hosts, but I can
>> AF> do it indirectly by copying to and from the local host:

>[...]
>> "scp foo:bar baz:blurfl" runs (essentially) "ssh foo scp bar baz:blurfl",
>> so authentication has to work from foo to bar directly.

>
>The ssh "-A" option for agent forwarding would be useful here. Anyone
>know why scp does not have that option?


Or at least '-oForwardAgent yes', but all -o options are thrown away
when doing remote-to-remote - does anyone know why *that* is? However if
you have (a carefully guarded) 'ForwardAgent yes' in your ssh_config, it
will apply to the initial ssh leg of scp remote-to-remote too... - and
can't be overridden with '-oForwardAgent no' on the commandline, since
that is thrown away...

--Per Hedeland
per@hedeland.org

Reply With Quote
  #9  
Old 12-07-2007, 12:53 PM
Junior Member
 
Join Date: Sep 2009
Posts: 0
Default Re: Should I be able to scp between two remote hosts?

On 2007-12-06, Nico Kadel-Garcia wrote:

> On 5 Dec, 21:03, Adam Funk wrote:
>> On 2007-12-04, OldSchool wrote:


>> > I've done it and AFAIK it requires that a) the key used be one of the
>> > defaults, like id_rsa or id_dsa, b) no passphrase, c) all three
>> > servers (the one issuing the command and the two remotes) accept the
>> > default from the other.

>>
>> I don't think it's worth having passphrase-free keys just for the rare
>> occasions when it would be useful to do this remote-remote copying.
>>
>> Thanks for the explanation.

>
> You can load the keys via ssh-agent for typing free use. That's what
> it's for.


I do that already. But what OldSchool is saying (I think) is that in
order to do this

local $ scp foo:~/file bar:~/

you have to have on host foo a passphrase-free key to your account on
bar.
Reply With Quote
Reply

Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Allow remote hosts for remote forwarded ports unix openssh 0 10-08-2007 12:42 AM
Re: Allow remote hosts for remote forwarded ports unix openssh 0 10-08-2007 12:42 AM
Re: Allow remote hosts for remote forwarded ports unix openssh 0 10-08-2007 12:42 AM
Allow remote hosts for remote forwarded ports unix openssh 0 10-08-2007 12:42 AM
Backup Remote Hosts unix Veritas Backup Exec 1 09-04-2001 09:30 PM


All times are GMT. The time now is 08:36 AM.