I have to transfer a file from my local machine to remote server 2 from remote server 1.

I have port forwarded the remote server1(Amazon Ec2) port 2222 to remote server2(Amazon Ec2). I am connecting that machine from my local by following command,

ssh -i server.pem ec2-user@IP -p 2222

I am trying to transfer file using scp, however I am not able to find the perfect solution. Please help me on this.

Note: Remote server 1 will act as a router.


scp uses uppercase P for the port option:

scp -i server.pem -P 2222 source-file ec2-user@IP:path/dest

Or did that gave an error? Which one?

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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