0

I am working in a server, to which I need to enter from another server, example:
ssh user@login1.de
ssh user@login2.de

Note that I can't connect to login2 directly, but only from login1.

Whenever I want to transfer files from login2 to my computer, I first have to transfer it from login2 to login1, and then from login1 to my computer. The problem is that login1 cannot contain files larger than 1GB (when login2 can), so its sort of a bottleneck.

My question is, is there a way to still use login1 as some sort of medium between my computer and login2, and still transfer files larger than 1GB?

Thanks.

0

Login to login1.de server via ssh from with your local server and do as following.

scp -3 user@login2.de:/file user@mylocal:/path/to/transfer

This will route scp traffic from server2 into your local server through server1.

  • This seems like a perfect solution, however I don't have a local server, its my private machine (if that even makes sense). – Joy Stick Sep 20 '17 at 8:55
  • your need a meter connection then – αғsнιη Sep 20 '17 at 9:39
  • Is there any other way? opening a local server seems to be beyond my capabilities. – Joy Stick Sep 20 '17 at 11:15
0

The key buzzword you're missing is "jump host", because that's what your login1 seems to be: a small-sized gateway that's not supposed to do anything that regulate where you can continue on to.

Given a recent enough ssh, you should be able to do

scp -o proxyjump=user@login1.de user@login2.de:/pth/to/file /pth/to/dest 

and on older ssh clients, it would be

scp -o proxycommand=“ssh user@login1.de -W %h:%p” user@login2.de:/pth/to/src /pth/to/tg 

In both cases, the connection will be opened to login1 and tunneled through to login2. (This probably requires that you either use agent forwarding or password authentication on login2, i.e. there is no private key on login1.)

In either case, and once you've verified that it works, you can stick the option in your ~/.ssh/config like so:

host login2.de
   ProxyJump user@login1.de
#   ProxyCommand ssh user@login1.de -W %h:%p

and then your ssh connections to login2 will always use the jump host without any need for explicit -o proxy... on the command line.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.