Creating a ssh tunnel to transfer files?

Posted by Vincent on Super User See other posts from Super User or by Vincent
Published on 2012-11-11T06:01:09Z Indexed on 2012/12/01 5:08 UTC
Read the original article Hit count: 408

Filed under:
|
|

For me, networks are a very "opaque" thing, and even with reading a lot of tutorial about SSH, I do not understand how to create a basic tunnel to transfer my files.

The configuration is the following :

My Computer --[Internet]--> Bridge Machine --[Local Network]--> Final Machine

Currently I do the following :

1) Connect to the Bridge Machine with :
ssh -X [email protected]

2) Connect to the Final Machine with :
ssh -X username@finalmachine

3) I copy the address of files I need (for example .../mydirectory)

4) Then I deconnect from the finalmachine with :
exit

5) I copy the files to the bridge :
scp -r username@finalmachine:/.../mydirectory .

6) I deconnect from the bridge with :
exit

7) I copy the files to my machine :
scp -r [email protected]:/.../mydirectory .

Which is quite complicated. My question is basic : how to simplify this using a SSH tunnel ?

(and please explain me the signification of each command line you write, to understand what each line really do and to avoid to use it like a magical thing. Furthermore if some ports number are used, explain me if I can pick a completely random number or if I have to choose a specific one.)

© Super User or respective owner

Related posts about linux

Related posts about ssh