2

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 1 GB (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 1 GB?

Thanks.

fra-san
  • 10,205
  • 2
  • 22
  • 43
Joy Stick
  • 21
  • 1

2 Answers2

2

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.

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.

αғsнιη
  • 41,407