0

This is probably not the first question about using scp with an intermediate host, but the way I access the target host through ssh has a bit of extras which I am not familiar with, and I have not been able to translate it to the different solutions I found about scp with intermediate host.

So here is the ssh command I use to connect to the target host:

ssh -p 3307 -t ${username}@${intemediate_host} \
  ssh -o StrictHostKeyChecking=no ${username}@${target_host}

With this command, I am only asked one password. (I think it is the one for ${intermediate_host})

Here is something I tried:

scp -o ProxyCommand="ssh -p 3307 -t -W %h:%p ${username}@${intemediate_host}" \
  -o StrictHostKeyChecking=no ${username}@${target_host}:file .

Unfortunately it doesn't work:

  • a password is asked for ${intermediate_host} (the one I enter using the ssh command)
  • another one is asked for accessing ${targe_host}, and I don't have it (not asked when using the ssh command`).

Can someone help me to convert this type of ssh access into a one liner for scp from ${target_host} to my machine?

Your Answer

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

Browse other questions tagged or ask your own question.