I want to copy files from a remote computer (W) to a private host computer (P) via scp. Since i can't connect to machine W directly i use an ssh tunnel over 2 different machines with port 22. What i would like to do, is to log into machine W and from there do an scp file transfer to machine P, the problem is that P is hidden in an network so i cant specify a remote host ip when i am logged into machine W. Is there a solution for this ?? I manage to do this when i am logged into machine P, but i dont want to remember the file path each time i copy a file.
After clarifying your setup as discussed above, your system looks like this:
Your only real problem is the router
You can then set up a second SSH tunnel from
Now this adds quite some complexity to the whole setup, which makes it quite error prone. A better solution would be to establish a VPN connection between
There are of course other solutions as well, but what you need to think through how the packets are going to get through all these blockades, the actual solution can then be tailored to fit your tools.
I would recommend mounting the remote file system locally using
I can now connect to R2 like so:
I can also use
I have tried this using a tunnel through one not two remote servers but I see no reason why it should not work with 3 or more as long as the tunnel has been properly set up.
This is not exactly what you asked for but it should serve as a workaround. Once you have the remote file system mounted locally, you can use simple