Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Paramiko: "FutureWarning: CTR mode needs counter parameter"

I am trying to use Paramiko in Python2 for transferring files through SFTP with a private SSH key but it displays this warning:

/usr/lib/python2.7/dist-packages/Crypto/Cipher/blockalgo.py:141: 
FutureWarning: CTR mode needs counter parameter, not IV   self._cipher = factory.new(key, *args, **kwargs)

In fact it sends the file to the server but can someone explain me what this warning means?

Here is my code:

t = paramiko.Transport((host, port))
key = paramiko.RSAKey.from_private_key_file("/path/to/key.ssh") 
t.connect(username="username",password=None, pkey=key)

sftp = paramiko.SFTPClient.from_transport(t)
sftp.put(source, destination)

sftp.close()
t.close()
like image 666
Adrián Kálazi Avatar asked Feb 03 '17 17:02

Adrián Kálazi


2 Answers

This is most likely a bug in paramiko

You can try to patch paramiko/transport.py with this patch to make the warning go away

See also the discussion here which references the pull request.

like image 143
hansaplast Avatar answered Nov 16 '22 16:11

hansaplast


This worked for me.

  1. Remove the python-paramiko package installed with apt:

apt remove python-paramiko

  1. Install paramiko via pip that provides a newer obviously fixed version:

apt install duplicity python-pip -y

pip install paramiko

like image 4
weefwefwqg3 Avatar answered Nov 16 '22 16:11

weefwefwqg3