title: Can't connect to remote server with Fabric and SSH using key file
body: <p>I'm trying to use a Fabric python script to log into the production server then run the 'ls' command remotely. Well I actually have lots of other commands to run, but I'm starting off with a simple list to get it working. My production server uses SSH and is locked down so it needs a private key file and password.</p>
  
  <p>Now I've been reading up on some sites about how to get this to work, but can't get it to log in for some reason. I think it connects ok but a message comes up saying:</p>
  
  <p><em><strong>Login password for 'root':</em></strong> </p>
  
  <p>So I enter my password (same as the one in env.password) and it just keeps popping up the message.</p>
  
  <p>Here's my fabfile.py:</p>
  
  <pre><code>from fabric.api import *
  
  env.use_ssh_config = True
  env.hosts = ["myserver.net"]
  env.user = "root"
  env.key_filename = "/home/myusername/.ssh/id_rsa.ppk"
  env.password = "mypassword"
  env.port = 22
  
  def testlive():
    run("ls")
  </code></pre>
  
  <p>Here's my SSH config in /home/myusername/.ssh/config:</p>
  
  <pre><code>Host myserver
    hostname myserver.net
    port 22
    IdentityFile ~/.ssh/id_rsa.ppk
  </code></pre>
  
  <p>Any ideas on how to get this working?</p>
  
  <p>Many thanks</p>