Harlo Holmes
Harlo Holmes

Reputation: 5145

Fabric connection to EC2 instance fails with Paramiko ValueError

I'm trying to connect to an EC2 instance using fabric (in python). I've set my env variables as so:

env.hosts = ['xxx-xxx.amazonaws.com']
env.user = "ubuntu"
env.key_filename = ['/path/to/my/ec2.pem']

the command

run('pwd')

gives the following error:

File "build/bdist.linux-x86_64/egg/paramiko/client.py", line 242, in connect
File "build/bdist.linux-x86_64/egg/paramiko/transport.py", line 346, in start_client
ValueError: CTR mode needs counter parameter, not IV

I'm using paramiko 1.14.0 (current) btw, and editing my ssh config to associate the pem to the host is not an option (although, I have tested the connection with ssh -i /path/to/pem and that was fine). Has anyone else had this problem and solved it?

Upvotes: 1

Views: 833

Answers (1)

Nick O'Neill
Nick O'Neill

Reputation: 131

I had the same error running a Python/Paramiko script on a new Ubunutu host. I wasn't able to determine the cause of the fault as I am new to Python but I resolved it by removing paramiko and its dependancies from /usr/local/lib/python2.7/dist-packages. I removed paramiko, pycrypto and ecdsa.

My system already has the following packages:

sudo apt-get install python-pip
sudo apt-get install python-dev

I re-installed paramiko with:

sudo pip install paramiko

I was able to run my script successfully without the the ValueError:

Versions of modules I am running:

ecdsa 0.11
paramiko 1.14.0
pycrypto 2.6.1

Upvotes: 3

Related Questions