title: Remote port forwarding with paramiko
body: <p>How do I implement remote port forwarding with Paramiko? I have seen examples doing the local port forward but this puzzles me.  I would like to implement</p>
  
  <pre><code>ssh -N -R 2210:localhost:5000 username@remotehost
  </code></pre>
  
  <p>with paramiko. (forward remotehost port 2210 to localhost port 5000, do not open shell as it is not permitted).  I have tried</p>
  
  <pre><code>ssh=paramiko.SSHClient()
  ssh.connect(remotehost, username=remoteusername, key_filename="/....")
  transport = ssh.get_transport()
  transport.open_channel(......)
  </code></pre>
  
  <p>but all combinations of dest_addr, src_addr and action (direct-tcpip, forwarded-tcpip) seem to fail to ChannelException (administrately prohibited). My command line ssh works, so I am authorised to do this, but I don't know how to do the Paramiko implementation. </p>
  
  <p>Any ideas?</p>
  
  <p>Hannu</p>