I have a nested SSH authentification through which I would like to transfer a file with SCP. To login I have to follow this process:
$ ssh external_user@external_host
// It prompts me for my external_password [a]
// It directly prompts me for my internal_user [b]
// Then it prompts a final time for my internal_password [c]
How can I SCP a file through such a SSH login process? (note, I never have to type the internal_host address, because once I typed my external_password at step [a], I immediately get told that it's trying to get me connecting to internal_host and that I need to type my internal_username
(when I simply try for scp external_user@external_host:myfile myfile it tells me that I'm connecting to an invalid target)
I've also tried with SFTP, but doing sftp external_user@external_host asks for my external_password and then I'm getting kick out with an invalid target message instead of getting asked for my internal_user.
Also, as suggested by one of the comment I tried scp -o ProxyJump=external_user@external_host test.txt internal_user@internal_host:test.txt, but it also kicked me after typing my external_password :
Received disconnect from UNKNOWN port 65535:11: Disconnection
Disconnected from UNKNOWN port 65535
ssh_exchange_identification: Connection closed by remote host
I found a possible solution but that will not work in my case since it requires a dependancy (lrzsz) on the final host, but it might works for some other users in a similar situation : https://github.com/mtatton/zssh