通过Paramiko的SFTPClient进行的无密码连接不起作用

2024-05-19 21:55:54 发布

您现在位置:Python中文网/ 问答频道 /正文

我有两个lxd容器,一个master,另一个是slave。我已经将masterssh-key粘贴到slave的{},这样我就可以通过简单地从master到{}进行无密码登录

ssh <slave-user>@<slave-ip>

没有任何密码。在

现在,我想用paramikoSFTPClient将一些文件从master发送到slave。代码应该是:

^{pr2}$

我在我的master节点上运行这段代码,10.154.151.252是{}的IP地址。请注意,我可以使用ssh轻松地将这两个连接起来。在

当我尝试使用无密码登录时,问题就来了。我也试过了 transport.connect(username="root",password=""),但那也没用。在

那么,我是不是遗漏了一些显而易见的东西?在


这是我生成的paramiko日志

^{3}$

/tmp/paramiko.log

DEB [20190331-16:09:01.123] thr=1   paramiko.transport: kex algos:['curve25519-sha256@libssh.org', 'ecdh-sha2-nistp256', 'ecdh-sha2-nistp384', 'ecdh-sha2-nistp521', 'diffie-hellman-group-exchange-sha256', 'diffie-hellman-group14-sha1'] server key:['ssh-rsa', 'rsa-sha2-512', 'rsa-sha2-256', '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
DEB [20190331-16:09:01.123] thr=1   paramiko.transport: Kex agreed: ecdh-sha2-nistp256
DEB [20190331-16:09:01.123] thr=1   paramiko.transport: HostKey agreed: ssh-ed25519
DEB [20190331-16:09:01.123] thr=1   paramiko.transport: Cipher agreed: aes128-ctr
DEB [20190331-16:09:01.124] thr=1   paramiko.transport: MAC agreed: hmac-sha2-256
DEB [20190331-16:09:01.124] thr=1   paramiko.transport: Compression agreed: none
DEB [20190331-16:09:01.358] thr=1   paramiko.transport: kex engine KexNistp256 specified hash_algo <built-in function openssl_sha256>
DEB [20190331-16:09:01.359] thr=1   paramiko.transport: Switch to new keys ...
DEB [20190331-16:09:23.334] thr=2   paramiko.transport: [chan 0] Max packet in: 32768 bytes
WAR [20190331-16:09:23.335] thr=1   paramiko.transport: Oops, unhandled type 3 ('unimplemented')
DEB [20190331-16:10:50.288] thr=1   paramiko.transport: EOF in transport thread

Tags: mastercomparamikodebhmacsha1sshslave