title: How to scp with a second remote host
body: <p>I wonder if there is a way for me to SCP the file from remote2 host directly from my local machine by going through a remote1 host.</p>
  
  <p>The networks only allow connections to remote2 host from remote1 host. Also, neither remote1 host nor remote2 host can scp to my local machine.</p>
  
  <p>Is there something like:</p>
  
  <p><code>scp user1@remote1:user2@remote2:file .</code></p>
  
  <p>First window: <code>ssh remote1</code>, then <code>scp remot2:file .</code>.</p>
  
  <p>Second shell: <code>scp remote1:file .</code></p>
  
  <p>First window: <code>rm file; logout</code></p>
  
  <p>I could write a script to do all these steps, but if there is a direct way, I would rather use it.</p>
  
  <p>Thanks.</p>
  
  <p><strong>EDIT:</strong> I am thinking something like opening SSH tunnels but i'm confused on what value to put where.</p>
  
  <p>At the moment, to access <code>remote1</code>, i have the following in <code>$HOME/.ssh/config</code> on my local machine.</p>
  
  <pre><code>Host remote1
     User     user1
     Hostname localhost
     Port     45678
  </code></pre>
  
  <p>Once on <code>remote1</code>, to access <code>remote2</code>, it's the standard local DNS and port 22. What should I put on <code>remote1</code> and/or change on <code>localhost</code>?</p>