0

Possible Duplicate:
Using an SSH keyfile with Fabric

In my fable

env.ip = 'x.x.x.x' 
env.hosts = [env.ip] 
env.user = 'root'
env.environment = 'production'

I have the config like this, but when I trying to execute something using run(command), it prompts me to put the password for root, why?

In my native Terminal.app, I can ssh x.x.x.x without entering the password.

I have enabled logging in the fabfile, and here is the ouput

DEBUG:ssh.transport:starting thread (client mode): 0xaa84dd0L
INFO:ssh.transport:Connected (version 2.0, client OpenSSH_5.8p1)
DEBUG:ssh.transport:kex algos:['ecdh-sha2-nistp256', 'ecdh-sha2-nistp384', 'ecdh-sha2-nistp521', 'diffie-hellman-group-exchange-sha256', 'diffie-hellman-group-exchange-sha1', 'diffie-hellman-group14-sha1', 'diffie-hellman-group1-sha1'] server key:['ssh-rsa', 'ssh-dss'] client encrypt:['aes128-ctr', 'aes192-ctr', 'aes256-ctr', 'arcfour256', 'arcfour128', 'aes128-cbc', '3des-cbc', 'blowfish-cbc', 'cast128-cbc', 'aes192-cbc', 'aes256-cbc', 'arcfour', 'rijndael-cbc@lysator.liu.se'] server encrypt:['aes128-ctr', 'aes192-ctr', 'aes256-ctr', 'arcfour256', 'arcfour128', 'aes128-cbc', '3des-cbc', 'blowfish-cbc', 'cast128-cbc', 'aes192-cbc', 'aes256-cbc', 'arcfour', 'rijndael-cbc@lysator.liu.se'] client mac:['hmac-md5', 'hmac-sha1', 'umac-64@openssh.com', 'hmac-ripemd160', 'hmac-ripemd160@openssh.com', 'hmac-sha1-96', 'hmac-md5-96'] server mac:['hmac-md5', 'hmac-sha1', 'umac-64@openssh.com', 'hmac-ripemd160', 'hmac-ripemd160@openssh.com', 'hmac-sha1-96', 'hmac-md5-96'] client compress:['none', 'zlib@openssh.com'] server compress:['none', 'zlib@openssh.com'] client lang:[''] server lang:[''] kex follows?False
DEBUG:ssh.transport:Ciphers agreed: local=aes128-ctr, remote=aes128-ctr
DEBUG:ssh.transport:using kex diffie-hellman-group1-sha1; server key type ssh-rsa; cipher: local aes128-ctr, remote aes128-ctr; mac: local hmac-sha1, remote hmac-sha1; compression: local none, remote none
DEBUG:ssh.transport:Switch to new keys ... [x.x.x.x] Login password for 'root':
Community
  • 1
  • 1
user469652
  • 48,855
  • 59
  • 128
  • 165

1 Answers1

2

You have to specify the path to the keyfile to use.

See this post for details, which boil down to adding

env.key_filename = '/path/to/keyfile.pem'

in your case.

Community
  • 1
  • 1
blahdiblah
  • 33,069
  • 21
  • 98
  • 152
  • It fixes the issue, but why it does not use the system's default behaviour? Because same code worked on my windows (my windows has ssh etc..). I do not have to specify where my key is. – user469652 Jul 28 '12 at 03:23
  • I don't know why it would behave differently on Windows, but it's not unusual to require that path to the keyfile be explicitly specified. Less unexpected behavior if everything has to be very explicit, and it facilitates using separate keys for regular SSH usage versus programmatic. – blahdiblah Jul 28 '12 at 03:27