I was wondering if there's a way to send files using SFTP to a remote machine through a jump server. As you can see in the image below first it's needed an SSH connection and after that an SFTP connection.
My main problem here comes after the SSH connection, my workspace has changed and I cannot retrieve the necessary files to execute the SFTP successfully. I've tried the following code:
ssh jump-server-user@ip-jump-server 'echo "put /source/files /remote/files" | sftp -v remote-machine-user@ip-remote-machine'
But it does not work.
I've tried to execute a simple command like pwd
using the SFTP connection and it works so I think the problem here is how the workspace change.
There would probably be an easier solution but I cannot use SSH on the jump server-remote machine connection and I cannot store the local files in the jump server to send them later to the remote machine.