Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/image-processing/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Fabric3连接到不使用';我没有密码_Python_Python 3.x_Ssh_Fabric - Fatal编程技术网

Python Fabric3连接到不使用';我没有密码

Python Fabric3连接到不使用';我没有密码,python,python-3.x,ssh,fabric,Python,Python 3.x,Ssh,Fabric,我有一个wandboard,我可以用paramiko实现ssh,但不能用Fabric3 1.14.post1 以下是带调试输出的paramiko(2.5.0)代码: #!/usr/bin/env python from logging import DEBUG, getLogger, basicConfig from paramiko import SSHClient, Transport basicConfig() getLogger("paramiko").setLevel(DEBUG)

我有一个wandboard,我可以用paramiko实现ssh,但不能用
Fabric3 1.14.post1
以下是带调试输出的paramiko(2.5.0)代码:

#!/usr/bin/env python

from logging import DEBUG, getLogger, basicConfig
from paramiko import SSHClient, Transport

basicConfig()
getLogger("paramiko").setLevel(DEBUG)

class SSH(SSHClient):
    def __init__(self, host, user, password=None, port=22):
        self._host = host
        self._user = user
        self._password = password
        self._port = port
        super(SSH, self).__init__()

        self._transport = Transport((self._host, self._port))
        self._transport.connect(username=self._user, password=self._password)
        if not self._password:
            self._transport.auth_none(username=self._user)

    def __enter__(self):
        return self

    def __exit__(self, *args):
        self.close()


# Working with both
with SSH('192.168.1.32', 'pi', '-+') as ssh:
    i, o, e = ssh.exec_command('uname -n')
    print(o.read())

print("#"*80)

# Not wokring with fabric
with SSH('192.168.1.119', 'root') as ssh:
    i, o, e = ssh.exec_command('uname -n')
    print(o.read())
输出:

DEBUG:paramiko.transport:starting thread (client mode): 0x7c4a0f60
DEBUG:paramiko.transport:Local version/idstring: SSH-2.0-paramiko_2.5.0
DEBUG:paramiko.transport:Remote version/idstring: SSH-2.0-OpenSSH_7.9p1 Raspbian-10
INFO:paramiko.transport:Connected (version 2.0, client OpenSSH_7.9p1)
DEBUG:paramiko.transport:kex algos:['curve25519-sha256', 'curve25519-sha256@libssh.org', 'ecdh-sha2-nistp256', 'ecdh-sha2-nistp384', 'ecdh-sha2-nistp521', 'diffie-hellman-group-exchange-sha256', 'diffie-hellman-group16-sha512', 'diffie-hellman-group18-sha512', 'diffie-hellman-group14-sha256', 'diffie-hellman-group14-sha1'] server key:['rsa-sha2-512', 'rsa-sha2-256', 'ssh-rsa', 'ecdsa-sha2-nistp256', 'ssh-ed25519'] client encrypt:['chacha20-poly1305@openssh.com', 'aes128-ctr', 'aes192-ctr', 'aes256-ctr', 'aes128-gcm@openssh.com', 'aes256-gcm@openssh.com'] server encrypt:['chacha20-poly1305@openssh.com', 'aes128-ctr', 'aes192-ctr', 'aes256-ctr', 'aes128-gcm@openssh.com', 'aes256-gcm@openssh.com'] client mac:['umac-64-etm@openssh.com', 'umac-128-etm@openssh.com', 'hmac-sha2-256-etm@openssh.com', 'hmac-sha2-512-etm@openssh.com', 'hmac-sha1-etm@openssh.com', 'umac-64@openssh.com', 'umac-128@openssh.com', 'hmac-sha2-256', 'hmac-sha2-512', 'hmac-sha1'] server mac:['umac-64-etm@openssh.com', 'umac-128-etm@openssh.com', 'hmac-sha2-256-etm@openssh.com', 'hmac-sha2-512-etm@openssh.com', 'hmac-sha1-etm@openssh.com', 'umac-64@openssh.com', 'umac-128@openssh.com', 'hmac-sha2-256', 'hmac-sha2-512', 'hmac-sha1'] client compress:['none', 'zlib@openssh.com'] server compress:['none', 'zlib@openssh.com'] client lang:[''] server lang:[''] kex follows?False
DEBUG:paramiko.transport:Kex agreed: curve25519-sha256@libssh.org
DEBUG:paramiko.transport:HostKey agreed: ssh-ed25519
DEBUG:paramiko.transport:Cipher agreed: aes128-ctr
DEBUG:paramiko.transport:MAC agreed: hmac-sha2-256
DEBUG:paramiko.transport:Compression agreed: none
DEBUG:paramiko.transport:kex engine KexCurve25519 specified hash_algo <built-in function openssl_sha256>
DEBUG:paramiko.transport:Switch to new keys ...
DEBUG:paramiko.transport:Attempting password auth...
DEBUG:paramiko.transport:userauth is OK
INFO:paramiko.transport:Authentication (password) successful!
DEBUG:paramiko.transport:[chan 0] Max packet in: 32768 bytes
DEBUG:paramiko.transport:Received global request "hostkeys-00@openssh.com"
DEBUG:paramiko.transport:Rejecting "hostkeys-00@openssh.com" global request from server.
DEBUG:paramiko.transport:[chan 0] Max packet out: 32768 bytes
DEBUG:paramiko.transport:Secsh channel 0 opened.
DEBUG:paramiko.transport:[chan 0] Sesch channel 0 request ok
DEBUG:paramiko.transport:[chan 0] EOF received (0)
b'raspberrypi\n'
################################################################################
DEBUG:paramiko.transport:Ignoring message for dead channel 0
DEBUG:paramiko.transport:starting thread (client mode): 0x7c4a3cc0
DEBUG:paramiko.transport:Local version/idstring: SSH-2.0-paramiko_2.5.0
DEBUG:paramiko.transport:Remote version/idstring: SSH-2.0-dropbear_2017.75
INFO:paramiko.transport:Connected (version 2.0, client dropbear_2017.75)
DEBUG:paramiko.transport:kex algos:['curve25519-sha256@libssh.org', 'ecdh-sha2-nistp521', 'ecdh-sha2-nistp384', 'ecdh-sha2-nistp256', 'diffie-hellman-group14-sha1', 'diffie-hellman-group1-sha1', 'kexguess2@matt.ucc.asn.au'] server key:['ssh-rsa'] client encrypt:['aes128-ctr', 'aes256-ctr', 'aes128-cbc', 'aes256-cbc', 'twofish256-cbc', 'twofish-cbc', 'twofish128-cbc', '3des-ctr', '3des-cbc'] server encrypt:['aes128-ctr', 'aes256-ctr', 'aes128-cbc', 'aes256-cbc', 'twofish256-cbc', 'twofish-cbc', 'twofish128-cbc', '3des-ctr', '3des-cbc'] client mac:['hmac-sha1-96', 'hmac-sha1', 'hmac-sha2-256', 'hmac-sha2-512', 'hmac-md5'] server mac:['hmac-sha1-96', 'hmac-sha1', 'hmac-sha2-256', 'hmac-sha2-512', 'hmac-md5'] client compress:['zlib@openssh.com', 'none'] server compress:['zlib@openssh.com', 'none'] client lang:[''] server lang:[''] kex follows?False
DEBUG:paramiko.transport:Kex agreed: curve25519-sha256@libssh.org
DEBUG:paramiko.transport:HostKey agreed: ssh-rsa
DEBUG:paramiko.transport:Cipher agreed: aes128-ctr
DEBUG:paramiko.transport:MAC agreed: hmac-sha2-256
DEBUG:paramiko.transport:Compression agreed: none
DEBUG:paramiko.transport:kex engine KexCurve25519 specified hash_algo <built-in function openssl_sha256>
DEBUG:paramiko.transport:Switch to new keys ...
DEBUG:paramiko.transport:userauth is OK
INFO:paramiko.transport:Authentication (none) successful!
DEBUG:paramiko.transport:[chan 0] Max packet in: 32768 bytes
DEBUG:paramiko.transport:[chan 0] Max packet out: 32759 bytes
DEBUG:paramiko.transport:Secsh channel 0 opened.
DEBUG:paramiko.transport:[chan 0] Sesch channel 0 request ok
DEBUG:paramiko.transport:[chan 0] EOF received (0)
b'wandboard\n'
DEBUG:paramiko.transport:EOF in transport thread
输出:

[192.168.1.32] run: uname -n
DEBUG:paramiko.transport:starting thread (client mode): 0xe3ec2da0
DEBUG:paramiko.transport:Local version/idstring: SSH-2.0-paramiko_2.5.0
DEBUG:paramiko.transport:Remote version/idstring: SSH-2.0-OpenSSH_7.9p1 Raspbian-10
INFO:paramiko.transport:Connected (version 2.0, client OpenSSH_7.9p1)
DEBUG:paramiko.transport:kex algos:['curve25519-sha256', 'curve25519-sha256@libssh.org', 'ecdh-sha2-nistp256', 'ecdh-sha2-nistp384', 'ecdh-sha2-nistp521', 'diffie-hellman-group-exchange-sha256', 'diffie-hellman-group16-sha512', 'diffie-hellman-group18-sha512', 'diffie-hellman-group14-sha256', 'diffie-hellman-group14-sha1'] server key:['rsa-sha2-512', 'rsa-sha2-256', 'ssh-rsa', 'ecdsa-sha2-nistp256', 'ssh-ed25519'] client encrypt:['chacha20-poly1305@openssh.com', 'aes128-ctr', 'aes192-ctr', 'aes256-ctr', 'aes128-gcm@openssh.com', 'aes256-gcm@openssh.com'] server encrypt:['chacha20-poly1305@openssh.com', 'aes128-ctr', 'aes192-ctr', 'aes256-ctr', 'aes128-gcm@openssh.com', 'aes256-gcm@openssh.com'] client mac:['umac-64-etm@openssh.com', 'umac-128-etm@openssh.com', 'hmac-sha2-256-etm@openssh.com', 'hmac-sha2-512-etm@openssh.com', 'hmac-sha1-etm@openssh.com', 'umac-64@openssh.com', 'umac-128@openssh.com', 'hmac-sha2-256', 'hmac-sha2-512', 'hmac-sha1'] server mac:['umac-64-etm@openssh.com', 'umac-128-etm@openssh.com', 'hmac-sha2-256-etm@openssh.com', 'hmac-sha2-512-etm@openssh.com', 'hmac-sha1-etm@openssh.com', 'umac-64@openssh.com', 'umac-128@openssh.com', 'hmac-sha2-256', 'hmac-sha2-512', 'hmac-sha1'] client compress:['none', 'zlib@openssh.com'] server compress:['none', 'zlib@openssh.com'] client lang:[''] server lang:[''] kex follows?False
DEBUG:paramiko.transport:Kex agreed: curve25519-sha256@libssh.org
DEBUG:paramiko.transport:HostKey agreed: ecdsa-sha2-nistp256
DEBUG:paramiko.transport:Cipher agreed: aes128-ctr
DEBUG:paramiko.transport:MAC agreed: hmac-sha2-256
DEBUG:paramiko.transport:Compression agreed: none
DEBUG:paramiko.transport:kex engine KexCurve25519 specified hash_algo <built-in function openssl_sha256>
DEBUG:paramiko.transport:Switch to new keys ...
DEBUG:paramiko.transport:Trying SSH agent key b'24a1a600a5a6c92ebfd5d46f86bcd30c'
DEBUG:paramiko.transport:userauth is OK
INFO:paramiko.transport:Authentication (publickey) failed.
DEBUG:paramiko.transport:Trying discovered key b'24a1a600a5a6c92ebfd5d46f86bcd30c' in /home/ramih/.ssh/id_rsa
DEBUG:paramiko.transport:userauth is OK
INFO:paramiko.transport:Authentication (publickey) failed.
DEBUG:paramiko.transport:userauth is OK
INFO:paramiko.transport:Authentication (password) successful!
DEBUG:paramiko.transport:[chan 0] Max packet in: 32768 bytes
DEBUG:paramiko.transport:Received global request "hostkeys-00@openssh.com"
DEBUG:paramiko.transport:Rejecting "hostkeys-00@openssh.com" global request from server.
DEBUG:paramiko.transport:[chan 0] Max packet out: 32768 bytes
DEBUG:paramiko.transport:Secsh channel 0 opened.
DEBUG:paramiko.transport:[chan 0] Sesch channel 0 request ok
DEBUG:paramiko.transport:[chan 0] Sesch channel 0 request ok
DEBUG:paramiko.transport:[chan 0] EOF received (0)
DEBUG:paramiko.transport:[chan 0] EOF sent (0)
[192.168.1.32] out: raspberrypi
[192.168.1.32] out: 

################################################################################
[192.168.1.119] run: uname -n
DEBUG:paramiko.transport:starting thread (client mode): 0xe3e94278
DEBUG:paramiko.transport:Local version/idstring: SSH-2.0-paramiko_2.5.0
DEBUG:paramiko.transport:Remote version/idstring: SSH-2.0-dropbear_2017.75
INFO:paramiko.transport:Connected (version 2.0, client dropbear_2017.75)
DEBUG:paramiko.transport:kex algos:['curve25519-sha256@libssh.org', 'ecdh-sha2-nistp521', 'ecdh-sha2-nistp384', 'ecdh-sha2-nistp256', 'diffie-hellman-group14-sha1', 'diffie-hellman-group1-sha1', 'kexguess2@matt.ucc.asn.au'] server key:['ssh-rsa'] client encrypt:['aes128-ctr', 'aes256-ctr', 'aes128-cbc', 'aes256-cbc', 'twofish256-cbc', 'twofish-cbc', 'twofish128-cbc', '3des-ctr', '3des-cbc'] server encrypt:['aes128-ctr', 'aes256-ctr', 'aes128-cbc', 'aes256-cbc', 'twofish256-cbc', 'twofish-cbc', 'twofish128-cbc', '3des-ctr', '3des-cbc'] client mac:['hmac-sha1-96', 'hmac-sha1', 'hmac-sha2-256', 'hmac-sha2-512', 'hmac-md5'] server mac:['hmac-sha1-96', 'hmac-sha1', 'hmac-sha2-256', 'hmac-sha2-512', 'hmac-md5'] client compress:['zlib@openssh.com', 'none'] server compress:['zlib@openssh.com', 'none'] client lang:[''] server lang:[''] kex follows?False
DEBUG:paramiko.transport:Kex agreed: curve25519-sha256@libssh.org
DEBUG:paramiko.transport:HostKey agreed: ssh-rsa
DEBUG:paramiko.transport:Cipher agreed: aes128-ctr
DEBUG:paramiko.transport:MAC agreed: hmac-sha2-256
DEBUG:paramiko.transport:Compression agreed: none
DEBUG:paramiko.transport:kex engine KexCurve25519 specified hash_algo <built-in function openssl_sha256>
DEBUG:paramiko.transport:Switch to new keys ...
DEBUG:paramiko.transport:Adding ssh-rsa host key for 192.168.1.119: b'6bac39c13ffdaa2687f3d283a7c4de3e'
DEBUG:paramiko.transport:Trying discovered key b'24a1a600a5a6c92ebfd5d46f86bcd30c' in /home/ramih/.ssh/id_rsa
DEBUG:paramiko.transport:userauth is OK
INFO:paramiko.transport:Authentication (publickey) failed.

Fatal error: Needed to prompt for a connection or sudo password (host: 192.168.1.119), but abort-on-prompts was set to True

Aborting.
[192.168.1.32]运行:uname-n
调试:paramiko.transport:启动线程(客户端模式):0xe3ec2da0
调试:paramiko.transport:本地版本/idstring:SSH-2.0-paramiko_2.5.0
调试:paramiko.transport:远程版本/idstring:SSH-2.0-OpenSSH_7.9p1 Raspbian-10
信息:paramiko.transport:Connected(版本2.0,客户端OpenSSH_7.9p1)
调试:paramiko.transport:kex算法:['curve25519-sha256','curve25519-sha256@libssh.org“,”ecdh-sha2-nistp256“,”ecdh-sha2-nistp384“,”ecdh-sha2-nistp521“,”diffie-hellman-group-exchange-sha256“,”diffie-hellman-group16-sha512“,”diffie-hellman-group18-sha512“,”diffie-hellman-group14-sha256“,”diffie-hellman-group14-sha1“]服务器密钥:['rsa-sha2-512','rsa-sha2-256','ssh rsa','ecdsa-sha2-nistp256','ssh-ed25519']客户端加密:['chacha20-poly1305@openssh.com“aes128中心”、“aes192中心”、“aes256中心”、“aes128中心”-gcm@openssh.com“,”aes256-gcm@openssh.com“]服务器加密:['chacha20-poly1305@openssh.com“aes128中心”、“aes192中心”、“aes256中心”、“aes128中心”-gcm@openssh.com“,”aes256-gcm@openssh.com“]客户端mac:['umac-64-etm@openssh.com“,”umac-128-etm@openssh.com“,”hmac-sha2-256-etm@openssh.com“,”hmac-sha2-512-etm@openssh.com“,”hmac-sha1-etm@openssh.com","umac",-64@openssh.com","umac",-128@openssh.com“,”hmac-sha2-256“,”hmac-sha2-512“,”hmac-sha1“]服务器mac:['umac-64-etm@openssh.com“,”umac-128-etm@openssh.com“,”hmac-sha2-256-etm@openssh.com“,”hmac-sha2-512-etm@openssh.com“,”hmac-sha1-etm@openssh.com","umac",-64@openssh.com","umac",-128@openssh.com“,”hmac-sha2-256“,”hmac-sha2-512“,”hmac-sha1“]客户端压缩:[”无“,”zlib@openssh.com“]服务器压缩:[‘无’,'zlib@openssh.com“]客户端语言:['']服务器语言:['']kex跟随?False
调试:paramiko.传输:Kex同意:curve25519-sha256@libssh.org
调试:paramiko.传输:主机密钥已同意:ecdsa-sha2-nistp256
调试:paramiko.传输:同意密码:aes128 ctr
调试:paramiko。传输:MAC同意:hmac-sha2-256
调试:paramiko.传输:压缩:无
调试:paramiko.transport:kex引擎KexCurve25519指定的哈希算法
调试:paramiko.transport:切换到新密钥。。。
调试:paramiko.transport:正在尝试SSH代理密钥b'24a1a600a5a6c92ebfd5d46f86bcd30c'
调试:paramiko.transport:userauth正常
信息:paramiko。传输:身份验证(公钥)失败。
调试:paramiko.transport:尝试在/home/ramih/.ssh/id_rsa中找到密钥b'24a1a600a5a6c92ebfd5d46f86bcd30c'
调试:paramiko.transport:userauth正常
信息:paramiko。传输:身份验证(公钥)失败。
调试:paramiko.transport:userauth正常
信息:paramiko。传输:身份验证(密码)成功!
调试:paramiko.transport:[chan 0]最大数据包长度:32768字节
调试:paramiko.transport:收到全局请求“主机密钥”-00@openssh.com"
调试:paramiko.transport:拒绝“主机密钥”-00@openssh.com“来自服务器的全局请求。
调试:paramiko.transport:[chan 0]最大数据包输出:32768字节
调试:paramiko。传输:已打开Secsh通道0。
调试:paramiko.transport:[chan 0]Sesch通道0请求正常
调试:paramiko.transport:[chan 0]Sesch通道0请求正常
调试:paramiko.transport:[chan 0]已接收EOF(0)
调试:paramiko.transport:[chan 0]已发送EOF(0)
[192.168.1.32]输出:树莓
[192.168.1.32]其中:
################################################################################
[192.168.1.119]运行:uname-n
调试:paramiko.transport:启动线程(客户端模式):0xe3e94278
调试:paramiko.transport:本地版本/idstring:SSH-2.0-paramiko_2.5.0
调试:paramiko.transport:远程版本/idstring:SSH-2.0-dropbear_2017.75
信息:paramiko.传输:已连接(版本2.0,客户端dropbear_2017.75)
调试:paramiko.transport:kex-algos:['curve25519-sha256@libssh.org‘ecdh-sha2-nistp521’、‘ecdh-sha2-nistp384’、‘ecdh-sha2-nistp256’、‘diffie-hellman-group14-sha1’、‘diffie-hellman-group1-sha1’、’kexguess2@matt.ucc.asn.au']服务器密钥:['ssh-rsa']客户端加密:服务器加密:['aes128-ctr','aes256 ctr','AES2128 cbc','twofish256 cbc','twofish256 cbc','twofish128 cbc','3des ctr','3des cbc']服务器加密:['aes128-ctr','aes256 ctr','aes256 cbc','twofish256 cbc','twofish256 cbc','twofish128 cbc','3des ctr','3des cbc']客户端mac:['hmac-sha1-96','hmac-sha1','hmac-sha2-256','hmac-sha2-512','hmac-md5']服务器mac:['hmac-sha1-96','hmac-sha1','hmac-sha2-256','hmac-sha2-512','hmac-md5']客户端压缩:['zlib@openssh.com“,”无“]服务器压缩:[”zlib@openssh.com“,”无“]客户端语言:['']服务器语言:['']kex跟随?False
调试:paramiko.传输:Kex同意:curve25519-sha256@libssh.org
调试:paramiko.transport:HostKey同意:ssh-rsa
调试:paramiko.传输:同意密码:aes128 ctr
调试:paramiko。传输:MAC同意:hmac-sha2-256
调试:paramiko.传输:压缩:无
调试:paramiko.transport:kex引擎KexCurve25519指定的哈希算法
调试:paramiko.transport:切换到新密钥。。。
调试:paramiko.transport:为192.168.1.119添加ssh rsa主机密钥:b'6bac39c13ffdaa2687f3d283a7c4de3e'
调试:paramiko.transport:尝试在/home/ramih/.ssh/id_rsa中找到密钥b'24a1a600a5a6c92ebfd5d46f86bcd30c'
调试:paramiko.transport:userauth正常
信息:paramiko。传输:身份验证(公钥)失败。
致命错误:需要提示输入连接或sudo密码(主机:192.168.1.119),但提示时中止设置为True
流产。
我尝试使用很多fabric env参数,但似乎没有任何效果,例如,无代理、转发代理
关键的区别在于身份验证,如何在fabric中进行身份验证(无)?

与@peshmerge不同,我喜欢Fabric3并衷心推荐它。也就是说,在运行时更改设置和环境时,诀窍是使用
execute
包装调用,对于无密码的情况,请确保使用
密钥文件n
[192.168.1.32] run: uname -n
DEBUG:paramiko.transport:starting thread (client mode): 0xe3ec2da0
DEBUG:paramiko.transport:Local version/idstring: SSH-2.0-paramiko_2.5.0
DEBUG:paramiko.transport:Remote version/idstring: SSH-2.0-OpenSSH_7.9p1 Raspbian-10
INFO:paramiko.transport:Connected (version 2.0, client OpenSSH_7.9p1)
DEBUG:paramiko.transport:kex algos:['curve25519-sha256', 'curve25519-sha256@libssh.org', 'ecdh-sha2-nistp256', 'ecdh-sha2-nistp384', 'ecdh-sha2-nistp521', 'diffie-hellman-group-exchange-sha256', 'diffie-hellman-group16-sha512', 'diffie-hellman-group18-sha512', 'diffie-hellman-group14-sha256', 'diffie-hellman-group14-sha1'] server key:['rsa-sha2-512', 'rsa-sha2-256', 'ssh-rsa', 'ecdsa-sha2-nistp256', 'ssh-ed25519'] client encrypt:['chacha20-poly1305@openssh.com', 'aes128-ctr', 'aes192-ctr', 'aes256-ctr', 'aes128-gcm@openssh.com', 'aes256-gcm@openssh.com'] server encrypt:['chacha20-poly1305@openssh.com', 'aes128-ctr', 'aes192-ctr', 'aes256-ctr', 'aes128-gcm@openssh.com', 'aes256-gcm@openssh.com'] client mac:['umac-64-etm@openssh.com', 'umac-128-etm@openssh.com', 'hmac-sha2-256-etm@openssh.com', 'hmac-sha2-512-etm@openssh.com', 'hmac-sha1-etm@openssh.com', 'umac-64@openssh.com', 'umac-128@openssh.com', 'hmac-sha2-256', 'hmac-sha2-512', 'hmac-sha1'] server mac:['umac-64-etm@openssh.com', 'umac-128-etm@openssh.com', 'hmac-sha2-256-etm@openssh.com', 'hmac-sha2-512-etm@openssh.com', 'hmac-sha1-etm@openssh.com', 'umac-64@openssh.com', 'umac-128@openssh.com', 'hmac-sha2-256', 'hmac-sha2-512', 'hmac-sha1'] client compress:['none', 'zlib@openssh.com'] server compress:['none', 'zlib@openssh.com'] client lang:[''] server lang:[''] kex follows?False
DEBUG:paramiko.transport:Kex agreed: curve25519-sha256@libssh.org
DEBUG:paramiko.transport:HostKey agreed: ecdsa-sha2-nistp256
DEBUG:paramiko.transport:Cipher agreed: aes128-ctr
DEBUG:paramiko.transport:MAC agreed: hmac-sha2-256
DEBUG:paramiko.transport:Compression agreed: none
DEBUG:paramiko.transport:kex engine KexCurve25519 specified hash_algo <built-in function openssl_sha256>
DEBUG:paramiko.transport:Switch to new keys ...
DEBUG:paramiko.transport:Trying SSH agent key b'24a1a600a5a6c92ebfd5d46f86bcd30c'
DEBUG:paramiko.transport:userauth is OK
INFO:paramiko.transport:Authentication (publickey) failed.
DEBUG:paramiko.transport:Trying discovered key b'24a1a600a5a6c92ebfd5d46f86bcd30c' in /home/ramih/.ssh/id_rsa
DEBUG:paramiko.transport:userauth is OK
INFO:paramiko.transport:Authentication (publickey) failed.
DEBUG:paramiko.transport:userauth is OK
INFO:paramiko.transport:Authentication (password) successful!
DEBUG:paramiko.transport:[chan 0] Max packet in: 32768 bytes
DEBUG:paramiko.transport:Received global request "hostkeys-00@openssh.com"
DEBUG:paramiko.transport:Rejecting "hostkeys-00@openssh.com" global request from server.
DEBUG:paramiko.transport:[chan 0] Max packet out: 32768 bytes
DEBUG:paramiko.transport:Secsh channel 0 opened.
DEBUG:paramiko.transport:[chan 0] Sesch channel 0 request ok
DEBUG:paramiko.transport:[chan 0] Sesch channel 0 request ok
DEBUG:paramiko.transport:[chan 0] EOF received (0)
DEBUG:paramiko.transport:[chan 0] EOF sent (0)
[192.168.1.32] out: raspberrypi
[192.168.1.32] out: 

################################################################################
[192.168.1.119] run: uname -n
DEBUG:paramiko.transport:starting thread (client mode): 0xe3e94278
DEBUG:paramiko.transport:Local version/idstring: SSH-2.0-paramiko_2.5.0
DEBUG:paramiko.transport:Remote version/idstring: SSH-2.0-dropbear_2017.75
INFO:paramiko.transport:Connected (version 2.0, client dropbear_2017.75)
DEBUG:paramiko.transport:kex algos:['curve25519-sha256@libssh.org', 'ecdh-sha2-nistp521', 'ecdh-sha2-nistp384', 'ecdh-sha2-nistp256', 'diffie-hellman-group14-sha1', 'diffie-hellman-group1-sha1', 'kexguess2@matt.ucc.asn.au'] server key:['ssh-rsa'] client encrypt:['aes128-ctr', 'aes256-ctr', 'aes128-cbc', 'aes256-cbc', 'twofish256-cbc', 'twofish-cbc', 'twofish128-cbc', '3des-ctr', '3des-cbc'] server encrypt:['aes128-ctr', 'aes256-ctr', 'aes128-cbc', 'aes256-cbc', 'twofish256-cbc', 'twofish-cbc', 'twofish128-cbc', '3des-ctr', '3des-cbc'] client mac:['hmac-sha1-96', 'hmac-sha1', 'hmac-sha2-256', 'hmac-sha2-512', 'hmac-md5'] server mac:['hmac-sha1-96', 'hmac-sha1', 'hmac-sha2-256', 'hmac-sha2-512', 'hmac-md5'] client compress:['zlib@openssh.com', 'none'] server compress:['zlib@openssh.com', 'none'] client lang:[''] server lang:[''] kex follows?False
DEBUG:paramiko.transport:Kex agreed: curve25519-sha256@libssh.org
DEBUG:paramiko.transport:HostKey agreed: ssh-rsa
DEBUG:paramiko.transport:Cipher agreed: aes128-ctr
DEBUG:paramiko.transport:MAC agreed: hmac-sha2-256
DEBUG:paramiko.transport:Compression agreed: none
DEBUG:paramiko.transport:kex engine KexCurve25519 specified hash_algo <built-in function openssl_sha256>
DEBUG:paramiko.transport:Switch to new keys ...
DEBUG:paramiko.transport:Adding ssh-rsa host key for 192.168.1.119: b'6bac39c13ffdaa2687f3d283a7c4de3e'
DEBUG:paramiko.transport:Trying discovered key b'24a1a600a5a6c92ebfd5d46f86bcd30c' in /home/ramih/.ssh/id_rsa
DEBUG:paramiko.transport:userauth is OK
INFO:paramiko.transport:Authentication (publickey) failed.

Fatal error: Needed to prompt for a connection or sudo password (host: 192.168.1.119), but abort-on-prompts was set to True

Aborting.
#!/usr/bin/env python

from logging import DEBUG, getLogger, basicConfig
from fabric.api import settings, run, execute

basicConfig()
getLogger("paramiko").setLevel(DEBUG)

def find_uname():
    run('uname -a')


# Working with both
with settings(host_string='192.168.1.32', user='pi', password='-+', abort_on_prompts=True):
    execute(find_uname)

print("#"*80)

# Not wokring with fabric
with settings(host_string='192.168.1.119', user='root', abort_on_prompts=True, key_filename='/path/to/my_ssh_key'):
    execute(find_uname)