I need to move files to destination server(s) to which we have to pass-through 2 jump servers. Currently this is how my alias are setup

alias tst = 'ssh -A -t xjmp01 ssh -A -t xjmp02 ssh -A -t qat1'  
alias qat = 'ssh -A -t xjmp01 ssh -A -t xjmp02 ssh -A -t qat2'

if I do 'tst' in Putty I get connected to qat1

Question: is there any way I can use this setup to move files as well - if yes, how ?

I have tried using the information given here: scp files via intermediate host

but those don't work with alias setup that I have.

  • 1
    The scp won't work because you've not set up your ssh configuration in the way suggested by your referenced post. – roaima Sep 19 '16 at 23:23
  1. set up proper configuration (in ~/.ssh/config) to your jump boxes, instead of these ad-hoc aliases:

    Host xjmp01
      # other required configuration
    Host xjmp02
      ProxyCommand ssh -W %h:%p xjmp01
    Host qat1
      ProxyCommand ssh -W %h:%p xjmp02
    Host qat2
      ProxyCommand ssh -W %h:%p xjmp02
  2. Now you should be able to connect to your hosts simply using

    ssh -A qat1
    ssh -A qat2
  3. The same way you should be able to transfer files:

    scp upload_file qat1:
    scp qat1:download_file .

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.