У меня есть два lxd
контейнера, один master
и другой a slave
. Я вставил ssh-key
из master
в ~/.ssh/authorized_keys
из slave
, чтобы я мог выполнять вход без пароля с master
в slave
просто
ssh <slave-user>@<slave-ip>
без пароля.
Теперь я хочу отправить некоторые файлы с master
на slave
, используя paramiko
s SFTPClient
. Код для этого будет:
>>> import paramiko
>>> transport = paramiko.Transport(("10.154.151.252"))
>>> transport.connect(username="root")
/usr/local/lib/python3.5/dist-packages/paramiko/kex_ecdh_nist.py:39: CryptographyDeprecationWarning: encode_point has been deprecated on EllipticCurvePublicNumbers and will be removed in a future version. Please use EllipticCurvePublicKey.public_bytes to obtain both compressed and uncompressed point encoding.
m.add_string(self.Q_C.public_numbers().encode_point())
/usr/local/lib/python3.5/dist-packages/paramiko/kex_ecdh_nist.py:96: CryptographyDeprecationWarning: Support for unsafe construction of public numbers from encoded data will be removed in a future version. Please use EllipticCurvePublicKey.from_encoded_point
self.curve, Q_S_bytes
/usr/local/lib/python3.5/dist-packages/paramiko/kex_ecdh_nist.py:111: CryptographyDeprecationWarning: encode_point has been deprecated on EllipticCurvePublicNumbers and will be removed in a future version. Please use EllipticCurvePublicKey.public_bytes to obtain both compressed and uncompressed point encoding.
hm.add_string(self.Q_C.public_numbers().encode_point())
>>> sftp = paramiko.SFTPClient.from_transport(transport)
Oops, unhandled type 3 ('unimplemented')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.5/dist-packages/paramiko/sftp_client.py", line 165, in from_transport
window_size=window_size, max_packet_size=max_packet_size
File "/usr/local/lib/python3.5/dist-packages/paramiko/transport.py", line 806, in open_session
timeout=timeout,
File "/usr/local/lib/python3.5/dist-packages/paramiko/transport.py", line 933, in open_channel
raise e
File "/usr/local/lib/python3.5/dist-packages/paramiko/transport.py", line 1982, in run
ptype, m = self.packetizer.read_message()
File "/usr/local/lib/python3.5/dist-packages/paramiko/packet.py", line 441, in read_message
header = self.read_all(self.__block_size_in, check_rekey=True)
File "/usr/local/lib/python3.5/dist-packages/paramiko/packet.py", line 290, in read_all
raise EOFError()
EOFError
Я запускаю этот код на своем master
узле, а 10.154.151.252
- это IP-адрес slave
. Обратите внимание, что я могу легко соединить их, используя ssh
.
Проблема возникает, когда я пытаюсь ввести пароль без логина. Я тоже пробовал
transport.connect(username="root",password="")
, но это тоже не сработало.
Итак, я что-то упускаю здесь очевидное?
Вот журнал paramiko, который я сгенерировал с помощью
paramiko.util.log_to_file('/tmp/paramiko.log')
/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