结构不使用SSH密钥 [英] Fabric does not use SSH key

查看:146
本文介绍了结构不使用SSH密钥的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
将SSH密钥文件与Fabric结合使用

Possible Duplicate:
Using an SSH keyfile with Fabric

在我的寓言中

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

我有这样的配置,但是当我尝试使用run(command)执行某些操作时,它提示我输入root的密码,为什么?

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?

在我的本机Terminal.app中,无需输入密码就可以SSH x.x.x.x.

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

我已启用登录fabfile,这是输出

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':

推荐答案

您必须指定要使用的密钥文件的路径.

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'

根据您的情况.

这篇关于结构不使用SSH密钥的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆