Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I need to copy files that are behind a firewall server using scp.

normaly to login to the server I do the following

ssh -p 5023 firewall.domainname.fr

now i am in behind the firewall I connect to master

ssh master.domainname.fr

and here my files are in a folder path, for instance user/lolo/myfolder/

What is the right way to do a scp of all files in user/lolo/myfolder/* to my local computer

thanks

share|improve this question

migrated from stackoverflow.com Mar 19 '13 at 18:11

This question came from our site for professional and enthusiast programmers.

add comment

1 Answer

Instead of manually hopping through the firewall configure ssh to tunnel through it automatically.

In your ~/.ssh/config put

Host master.domainname.fr
ProxyCommand ssh firewall.domainname.fr -p 5023 -W %h:%p

With the proxy command configured both ssh master.domainname.fr and scp "master.domainname.fr:/user/lolo/myfolder/*" . should just work from your local computer.

If you use an old ssh version (older than 5.4) that does not have the -W option, you will have to use something else, such as nc, for the proxy command.

share|improve this answer
add comment

Your Answer

 
discard

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