title: How to chain SOCKS proxies?
body: <p>I have a working socks proxy from my laptop (machine A) to machine B:</p>
  
  <p><code>
  [A]$ ssh -ND 8888 B
  </code></p>
  
  <p>I can set up firefox to use socks proxy on the local port 8888, and browsing works. So far so good.</p>
  
  <p>But I also have a socks proxy between machines B and C:</p>
  
  <p><code>
  [B]$ ssh -ND 8157 C
  </code></p>
  
  <p>So I can browse on B as if I were on C.</p>
  
  <p><strong>Is there a way to chain the two proxies so that I'm able to use firefox locally (on A) while using the connection to C?</strong> That is, somehow forward all firefox's socks requests all the way from A to C. A and C cannot see each other directly, but I have full root ssh access everywhere. All machines are Debian.</p>
  
  <p>Note that I don't want to forward a single port (like 80), I want a full chained socks proxy.</p>