scp with different users

Alex Bligh alex at
Tue Oct 11 09:59:54 EST 2011


--On 11 October 2011 00:50:21 +0200 Peter Stuge <peter at> wrote:

>> The former copies file 'c' from user 'a' at host 'b' to the current
>> user at host 'd'.
> Sorry, where I wrote c I meant to write b.

No problem

>> What I am asking is why the former can succeed but the latter fail
> What you asked before was the opposite. Which is it? :)

I wrote it the wrong way around - I think that makes us 'one all' :-)

Copying via the intermediate file works. Copying between hosts b and d
as a single command fails.

> Does ssh a at b ssh d work?

"ssh a at b" works
"ssh d" works
"ssh a at b ssh d" (as a single command) will not work, as b does not have
the private key to get to d, only localhost does.

I had presumed (perhaps wrongly), that scp was opening two sessions,
one to b and one to d, and acting as a sort of intermediary.

> Is the username on d also a, or is the username on d the same as on
> the local machine?

The username on d is the same as on the local machine.

Alex Bligh

More information about the openssh-unix-dev mailing list