title: Openssh Connection refused when AuthorizedKeysCommand is present
body: <p>I am trying to authenticate a user in LDAP using ssh key pairs. I am running Ubuntu 14.04.
  I have LDAP setup with a user account that has an ssh public key objectclass (already applied schema). However there is supposably a new command that openssh sshd_config is able to accept called AuthorizedKeysCommand which accepts a script to lookup ssh keys for a user. </p>
  
  <p>See <a href="https://marc.waeckerlin.org/computer/index#combine_ssh_public-key_and_ldap_on_ubuntu" rel="nofollow">combine_ssh_public-key_and_ldap_on_ubuntu</a></p>
  
  <p>My problem is that when I add this command and then restart sshd, it does not listen on port 22. It says </p>
  
  <pre><code>ssh stop/waiting
  ssh start/running
  </code></pre>
  
  <p>And when I run 'service ssh status', I see this:</p>
  
  <pre><code>ssh start/running
  </code></pre>
  
  <p>However, when I try to connect, ie. 'ssh localhost', I get this:</p>
  
  <pre><code>ssh: connect to host localhost port 22: Connection refused
  </code></pre>
  
  <p>When I check the listening ports with </p>
  
  <pre><code>netstat -a | egrep 'Proto|LISTEN'
  </code></pre>
  
  <p>I see this:</p>
  
  <pre><code>Proto Recv-Q Send-Q Local Address           Foreign Address         State
  tcp        0      0 10.5.0.36:domain        *:*                     LISTEN
  tcp        0      0 localhost:domain        *:*                     LISTEN
  tcp        0      0 localhost:953           *:*                     LISTEN
  tcp        0      0 *:ldap                  *:*                     LISTEN
  tcp6       0      0 [::]:domain             [::]:*                  LISTEN
  tcp6       0      0 ip6-localhost:953       [::]:*                  LISTEN
  tcp6       0      0 [::]:ldap               [::]:*                  LISTEN
  </code></pre>
  
  <p>So ssh is not listening on port 22, it's not listening on any port. It doesn't even look like it started. 
  When I comment out this one line in my sshd_conf it starts fine.</p>
  
  <pre><code>AuthorizedKeysCommand "/etc/ssh/ldap-keys.sh"
  </code></pre>
  
  <p>Does anyone know what I'm doing wrong?</p>
  
  <p>ssh -V returns 1:6.6p1</p>