scp with different users

Peter Stuge peter at
Tue Oct 11 10:03:21 EST 2011

Alex Bligh wrote:
>> 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,

Then scp from b to d will also not work.

> as b does not have the private key to get to d, only localhost
> does.

You can use ssh-agent to make direct communication from b to d work
while the key remains on localhost.

> 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.

Yes, wrongly.

>> 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.

Cool. It doesn't work because a at b can not authenticate for d. scp
does not first download data locally unless you explicitly tell it


More information about the openssh-unix-dev mailing list