Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a large amount of data to send from one server to another. I access servers via ssh using a private key.

The problem is that I cannot use that key to scp files from one such server to another - server One doesn't have the private key which server Two expects (only the public part), so Two won't allow access from One.

The only way to send files would be to get them to my computer first (too slow), send private key to one of the servers (probably won't explode in this case, but I really really hate such solutions), or create extra accounts just for that or one of the servers.

Doesn't ssh have some way to let an ssh session forward authorization? That would be really great.

share|improve this question

2 Answers 2

up vote 5 down vote accepted

Assuming you have the same public key present in ~/.ssh/authorized_keys on both servers, and that you are running some kind of ssh agent locally, then you can use Agent forwarding.

localcomputer$ ssh -o ForwardAgent=yes youruser@server.one

That way, when you from server.one run your scp session against server.two the authentication will transparently be handled in the background by your local computer . Just note the following warning, taken from ssh_config(5)

Agent forwarding should be enabled with caution. Users with the ability to bypass file permissions on the remote host (for the agent's Unix-domain socket) can access the local agent through the forwarded connection. An attacker cannot obtain key material from the agent, however they can perform operations on the keys that enable them to authenticate using the identities loaded into the agent.

(In short, to a certain degree you will have to trust root@server.one.)

share|improve this answer
1  
Note that might not work with scp as it explicitly disables agent forwarding. –  Tgr Aug 19 '11 at 12:13

On a sidenote :

If you're sending large data volumes, you'd better use tar-over-ssh, instead of scp. Is really much faster.

see howto use tar over ssh

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.