I am typically logging in on a network via ssh and then to yet another computer again via ssh to my final destination computer. For instance a home server, and once there to one of my family's computers. That looks something like:
user0@inital:> ssh -P port_number user1@server
user1@server:> ssh -P port_number user2@final
user2@final:>
Once on user2@final
I would like to copy (scp) back to user0@inital
.
For instance I can do local port forwarding and copy form my local computer to the remote one over the server. On user0@initial
user0@initial:> ssh -L4321:final:22 -p 443 user1@server
This forwards the local port 4321
form user0@initial
via user1@server
to port 22
on user2@final
. Then on user0@initial
by running
scp -P 4321 some_file [email protected]:~/
I can copy to user2@final
over user1@server
.
The question is how to reverse things and copy back from user2@final
to user0@initial
.
Thank you for your help.