title: Mosh via two-level ssh (FreeBSD, jails)
body: <p>I am fond of <a href="http://mosh.mit.edu/" rel="nofollow">mosh</a> but I have problem connecting via two-level ssh. Consider this scenario:</p>
  
  <ul>
  <li>host machine running FreeBSD which has closed all ports from outside</li>
  <li>first jail having ssh port 2222 open from the outside is on public IP let's say door.example.com</li>
  <li>second jail with private IP address named DEV.example.com that can be ssh-ed from door.example.com on port 2222 as well</li>
  <li>redirection is set up to forward udp port 60000 from door.example.com to DEV.example.com</li>
  </ul>
  
  <p>There is generaly some problem with ttys and jails, but I am able to connect this way:</p>
  
  <pre><code>ssh -t -t -p2222 door.example.com -- ssh -p2222 DEV.example.com
  </code></pre>
  
  <p>being asked for both password to door.example.com and DEV.example.com afterwards.</p>
  
  <p>I have tried this mosh command (also tried all variations with and without <code>-t -t</code> params):</p>
  
  <pre><code>mosh --port 60000 \
    --ssh "ssh -t -t -p2222" \
    --server "ssh -t -t -p2222 DEV.example.com mosh-server" \
    door.example.com
  </code></pre>
  
  <p>but I always get hanging on password authentication to the second jail with no password prompt.</p>
  
  <p>Funny thing is that from <a href="http://dan.drown.org/android/mosh/" rel="nofollow">android mosh-flavored irssi connect bot</a> this works when I set up mosh port to 60000 and as mosh server I fill in <code>ssh -t -t -p2222 DEV.example.com mosh-server</code></p>
  
  <p>I know there are ways to set-up ssh proxy but I don't want to have things like netcat on the door jail. This should work somehow especially because it already works from my phone. </p>